Configuration via cli [Solved]

When I configure OpenWRT via the web (LuCi) everything works. Now I want to configure OpenWRT via SSH
What I will configure

  1. Wireless
  2. Wireguard
  3. Firewall

I login to OpenWRT via ssh

ssh root@
vi /etc/config/wireless

I will write at the end of the file

config wifi-iface 'wifinet1'
        option device 'radio0'
        option mode 'sta'
        option network 'wwan'
        option ssid 'my_ssid'
        option encryption 'psk2'
        option key 'my_password'

vi /etc/config/network

I will write at the end of the file

config interface 'wwan'                   
        option proto 'dhcp'

config interface 'wg0'         
        option proto 'wireguard'
        option private_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx='
        option listen_port '51820'                                       
        list addresses ''                                       
config wireguard_wg0                                                     
        option description 'server'                                      
        option public_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=' 
        list allowed_ips ''                                  
        list allowed_ips ''                                
        option route_allowed_ips '1'                                     
        option endpoint_host ''                            
        option endpoint_port '51820'   
vi /etc/config/firewall

I will write at the end of the file

config zone                                     
        option name 'wg0'                       
        option input 'ACCEPT'                   
        option output 'ACCEPT'                  
        option forward 'REJECT'                 
        list network 'wg0'

config forwarding                               
        option src 'lan'                        
        option dest 'wg0'

config forwarding                               
        option src 'wg0'                        
        option dest 'lan'



After the reboot, I SSH in and enable wireless

uci set wireless.radio0.disabled='0'
uci commit wireless
wifi reload

vI will install wireguard

opkg update
opkg install luci-app-wireguard

After the reboot everything seems to work. I can log in from a LAN network via wireguard to a remote network on the other side of the world.
However, I cannot access the Internet from the LAN network.
What else did I forget?
Does it look like a problem with DNS?

If you have ssh, and I assume router still got luci, why not tunnel the web traffic?

1 Like

Since you're not tunneling the whole Internet, the wwan interface (the regular wan) should be added to the wan zone and a forward from lan to wan included (which is there by default). Then access to general Internet (everywhere other than the allowed_ips) will go unencrypted by the wwan and the local ISP.



uci add_list'wwan'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.