Home » Embedded, Linux, Quick Tip, Shell

Adding an IP alias on DD-WRT lan interfaces

13 January 2010 6 Comments

I didn’t find any straight documentation about that, so I decide to write myself one.

Adding an IP alias under dd-wrt console (linux) is simple:

ifconfig br0:1 <ip_address> <netmask>

and is done. Now we should save this command for running on startup. You have 2 choices:

1. web interface
2. shell (ssh or telenet)

1. Web interface

Go to Administration Tab -> Command.
Type the following commands on Command edit box:


#!/bin/ash
PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}"
ifconfig br0:1 <ip_address> <netmask>

Now press Save Startup
Now you can reboot you router.

2. Shell interface

Log on your router.
and runt the following command:

$ nvram set rc_startup="
#!/bin/ash
PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}"
ifconfig br0:1 <ip_address> <netmask>
"
$ nvram commit

Success !


6 Comments »

  • cod3fr3ak said:

    !!!
    I was looking for this for days.

    Essentially I have two other networks all plugged into the same switch. I want the dd-wrt gateway to route between all of them. I could get the configuration working on a linux router but was stumped with this device.
    I finally got it working. Thanks a lot!

  • sacx said:

    If you are look, very close, to different setups of dd-wrt you will see this type of configuration in a lot of places, but none of the authors doesn’t name that “IP Alias”. Also, myself, I looked some time until I found this solution.

    Regards

  • ranj said:

    thanx a lot..

  • Iron said:

    Oooooh! Man! thax a loooooooot!) You saved my time! God bless you!)))

  • Cristiano Santos said:

    Very good post my friend!
    🙂

  • John said:

    Huh? ifconfig br0:1 192.168.10.1 255.255.255.0 results in
    “ifconfig: SIOCSIFADDR: Invalid argument”

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.