#349 closed (fixed)
"ip add add" doesn't work when done in startup script, x86
| Reported by: | jaarli@… | Owned by: | somebody |
|---|---|---|---|
| Keywords: | x86, startup script, ip addr | Cc: |
Description
I'm using DD-WRT v24 RC-6 (01/02/08) std - build 8743 in x86...
Following and adapting instructions from here http://www.dd-wrt.com/wiki/index.php/Access_To_Modem_Configuration doesn't work anymore... eth0 is my WAN-adapter
In startup script I use this line: "ip addr add 192.168.0.10/24 dev eth0 brd +" but in SSH "ip addr show" gives only this to eth0:
"7: eth0: <BROADCAST,MULTICAST,ALLMULTI,PROMISC,UP,10000> mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:1b:21:04:56:21 brd ff:ff:ff:ff:ff:ff inet 85.157.11.202/19 brd 85.157.31.255 scope global eth0 inet6 fe80::21b:21ff:fe04:5621/64 scope link
valid_lft forever preferred_lft forever"
Also "route" doesn't show 192.168.0.0 in destination... So somehow DD-WRT loses the effect of IP command in startup, maybe the DHCP from WAN "replaces" it? (guessing possible causes).
However, if I run same "ip addr add 192.168.0.10/24 dev eth0 brd +" in firewall, it works... But This shouldn't be that way, as router should make and keep the 192.168.0.10 on eth0 allways there, independant of "firewall"/interface up -rules...
Also it works when I run that command by hand in SSH...
"route" gives additional destination of 192.168.0.0, and "ip addr show" gives this additional line for eth0: "inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0"
Again I don't know what exact build it stopped to work as I didn't need to access my modem settings for pretty long perioid of time, but AFAIK this is pretty fresh flaw... So this same stuff worked in earlier builds...
Change History (7)
comment:1 Changed 5 years ago by jaarli@…
comment:2 Changed 5 years ago by BrainSlayer
- Resolution set to invalid
- Status changed from new to closed
use rc_firewall instead of rc_startup
comment:3 Changed 5 years ago by jaarli@…
- Resolution invalid deleted
- Status changed from closed to reopened
As said, I can use rc_firewall, or do it manually, but the real problem is that when I do DHCP renew, the manual IP (192.168.0.10) is lost in newer builds. This is not how it is supposed to work, instead I should be able to add as many IP numbers I want to without those to be vanished when DHCP renew happends to occur...
If my internet goes down for some reason then this happends automatically and again manual IP is lost...
So in effect, it shouldn't matter do I add IP ADDR ADD in rc_startup or in rc_firewall or manually in SSH, IP should stay there independant of DHCP renewal.
DHCP renewal should only affect the the one IP number it affect, not wipe out manually added _additional_ IP numbers for the interface.
comment:4 Changed 5 years ago by jaarli@…
- Resolution set to fixed
- Status changed from reopened to closed
HEY, I actually got this one solved, in the end it was pretty simple thing...
"ip addr add 192.168.0.10/24 dev eth0 brd +" or "ifconfig eth0 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255"
doesn't survive WAN DHCP renewal.
"ifconfig eth0:1 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255"
does the trick. This way the secondary IP will survive and be "persistent" so to speak.
Also nitpicking: I use rc_startup to this IP addition and IPtables (from tutorial) in rc_firewall, as adding secondary IP isn't relating to having WAN up, but to getting access to bridged modem settigs independant of what is status of actual WAN IP or stuff.
P.S. Wiki entry modified.'to accommondate.
comment:5 follow-up: ↓ 6 Changed 5 years ago by BrainSlayer
since rc_firewall is called on wan renewal as well, rc_firewall will work too
comment:6 in reply to: ↑ 5 Changed 5 years ago by anonymous
Replying to BrainSlayer:
since rc_firewall is called on wan renewal as well, rc_firewall will work too
Yes, rc_firewall might re-do the additional IP yes, but the main point of _access modem configuration_ should not be related to WAN IP and WAN access itself, and be accessible _at all times_. doing it as eth0:<number> seems to do just that, IP that doesn't relate to another IP of same interface.

Yes, I was correct that DHCP getting IP triggers the problem... When I have ran the "ap addr add" command by hand and verified it works, then did DHCP release, route to modem was still there, but when I hit DHCP renew, my route to modem disappears... Just as described in first post.. No destination in "route" command, and no IP interface in "ip addr show" command either...
So somehow DHCP renewing "wipes" whole manual IP completely away, when it obviously shouldn't do that.