OpenWrt Forum Archive

Topic: Setting up an ip alias on an interface

The content of this topic has been archived on 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, All,

I have multiple public ip addresses for my network that I would like to use.  I know I can manually run "ifconfig eth0.1:1 192.68.1..2", which would set the eth0.1 interface with the ip alias of 192.168.1.2.  However, I can't seem to find how to do it using the /etc/config/network file found in kamikaze.  Anyone know if its possible and what the correct syntax should be?


Thanks.

William.

Hi,

I've just startet now moving from from Whiterussian to Kamikaze. In Whiterussian it was pretty easy. (Just add an "ifup lan2" and use the nvram variables).
In Kamikaze I've found the following for my public IP's:

config interface lan2
        option ifname   "br-lan:0"
        option proto    static
        option ipaddr   w.x.y.z
        option netmask  255.255.255.xxx
        option bcast w.x.y.z

Note: The "option type" must be absent!

Just unfortunately this doesn't come up at boot time. I hadn't time to investigate but presumably the interface is being tried to come up before the switch which of course fails.

So modifying /etc/init.d/networking helps:

boot() {
        setup_switch() { return 0; }

        include /lib/network
        setup_switch
        [ -e /etc/config/wireless ] || \
                /sbin/wifi detect > /etc/config/wireless
        /sbin/wifi up
# Add my public ip interface...
        ifup lan2
}

(Last edited by cpalm on 15 Jul 2007, 02:13)

My issue has been resolved and I am adding the location of where I got the information/fix for anyone who is looking for a way to resolve this.

The following bug report helped me set multiple ip's per interface on kamikaze 7.06. 

(https://dev.openwrt.org/ticket/1727)

-William

wcastillo wrote:

My issue has been resolved and I am adding the location of where I got the information/fix for anyone who is looking for a way to resolve this.

The following bug report helped me set multiple ip's per interface on kamikaze 7.06. 

(https://dev.openwrt.org/ticket/1727)

-William

Excellent work.
Just upgraded to kamikaze after having to reboot Whiterussian RC6 for the 1st time in 13 months. Really, the devs must do better smile
I was experiencing the same problem; trying to stick to the config file format and getting the interface automatically brought up. Manually applying that patch cracked it. Strange it didn't make it into 7.09.
Cheers.

(Last edited by gildenman on 18 Feb 2008, 12:26)

cpalm wrote:

In Kamikaze I've found the following for my public IP's:

config interface lan2
        option ifname   "br-lan:0"
        option proto    static
        option ipaddr   w.x.y.z
        option netmask  255.255.255.xxx
        option bcast w.x.y.z

Note: The "option type" must be absent!

Just unfortunately this doesn't come up at boot time. I hadn't time to investigate but presumably the interface is being tried to come up before the switch which of course fails.

Is this supposed to work now in trunk? No alias created at boot time for me, but if I run network restart manually it creates the alias interface, but with the following messages

/etc/rc.common: eval: line 13: setup_switch: not found
ifconfig: SIOCSIFFLAGS: Cannot assign requested address

// Floppe

Thank you!

Works really nice.

The discussion might have continued from here.