Configuring WAN connection type via command line question

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
jester322
DD-WRT Novice


Joined: 27 Jul 2021
Posts: 11

PostPosted: Sat Nov 26, 2022 21:36    Post subject: Configuring WAN connection type via command line question Reply with quote
Greetings to DD-WRT community.

I have non-trivial question about managing WAN connection type via command line.
My case that router uses WAN connection for 2 different type of Internet connection:
1. Auto DHCP
2. Static IP

Let say in Static IP Wan connection 192.168.0.1 is a gateway, Static IP for router is 192.168.0.100 in 192.168.0.0/24 network. Router should provide Internet via this connection to subnet where router itself is a gateway - 192.168.5.0/24.

By default I configured in web interface Auto DHCP case, and it works fine. When switching to Static IP WAN connection, I am running following commands:

kill -SIGUSR2 "$(pidof udhcpc)"
kill -SIGUSR1 "$(pidof udhcpc)"
ifconfig eth0 192.168.0.100 netmask 255.255.255.0
route add default gw 192.168.0.1 eth0

After these commands router has connection to Internet with assigned address, but devices in 192.168.5.0/24 subnet do not have it. ip route show seems to be correct:

default via 192.168.0.1 dev eth0
127.0.0.0/8 dev lo scope link
192.168.0.0/24 dev eth0 scope link src 192.168.0.100
192.168.5.0/24 dev br0 scope link src 192.168.5.1

Still searching for info, how to handle this issue via command line. I also tried to play with nvram values, such as:
nvram set wan_ipaddr="192.168.0.100"
nvram set wan_gateway="192.168.0.1"
nvram set wan_proto="static"
and then running above-mentioned commands (kill, kill, ifconfig, route), but it leads to the same result.
Sponsor
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6856
Location: Romerike, Norway

PostPosted: Sat Nov 26, 2022 23:31    Post subject: Reply with quote
https://forum.dd-wrt.com/wiki/index.php/Category:Dual_WAN

There should be something you can use.
jester322
DD-WRT Novice


Joined: 27 Jul 2021
Posts: 11

PostPosted: Thu Dec 22, 2022 17:32    Post subject: Reply with quote
Per Yngve Berg

Thank you for response. I need to clarify that I do not need 2 WAN's simultaneously, I need ability to switch between them from command line. The only issue that one connection gets parameters automatically via DHCP, and for second one I need to specify it manually. My concern - is it possible to handle this manual settings without committing them to nvram and handle with config files, restarting udhcpc, set route/ip commands via command line?
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum