LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   IP alias - SIOCSIFFLAGS: Cannot assign requested address (https://www.linuxquestions.org/questions/slackware-14/ip-alias-siocsifflags-cannot-assign-requested-address-912985/)

yenn 11-11-2011 05:29 AM

IP alias - SIOCSIFFLAGS: Cannot assign requested address
 
Hi,

I'm trying to set up IP alias on one NIC for MIMO (Nanostation M5) administration and network monitoring. There is one cable from MIMO to router and router network interface is configured for outer network. It works fine, but I can't set IP alias eth0:0
Code:

root@router:~# ifconfig eth0:0 172.16.172.1 netmask 255.255.255.0 up
SIOCSIFFLAGS: Cannot assign requested address

I also tried simple tests (on different NIC's), but they also fails
Code:

root@router:~# ifconfig eth0:0 up
SIOCSIFFLAGS: Cannot assign requested address

Strange thing is that same network setup works fine on another router running Debian. However it doesn't work on Slackware 13.37, -current (another linux box, just for sure).

ifconfig:
Code:

eth0      Link encap:Ethernet  HWaddr 00:1A:4D:6E:B0:99 
          inet addr:1.2.3.4  Bcast:1.2.3.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:4dff:fe6e:b099/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4574071 errors:0 dropped:457 overruns:0 frame:0
          TX packets:747590 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1432436789 (1366.0 Mb)  TX bytes:111777822 (106.5 Mb)
          Interrupt:41 Base address:0x6000

eth2      Link encap:Ethernet  HWaddr 00:0E:2E:D0:57:D9 
          inet addr:10.1.4.1  Bcast:10.1.7.255  Mask:255.255.252.0
          inet6 addr: fec0::c:20e:2eff:fed0:57d9/64 Scope:Site
          inet6 addr: 2002:9320:1d9c:c:20e:2eff:fed0:57d9/64 Scope:Global
          inet6 addr: fe80::20e:2eff:fed0:57d9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:594914 errors:0 dropped:0 overruns:0 frame:0
          TX packets:931406 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:85421426 (81.4 Mb)  TX bytes:1115441768 (1063.7 Mb)
          Interrupt:20 Base address:0xa000

eth3      Link encap:Ethernet  HWaddr 00:50:FC:B1:55:A6 
          inet addr:10.1.1.1  Bcast:10.1.3.255  Mask:255.255.252.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:19 Base address:0xa400

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:130004 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11424593 (10.8 Mb)  TX bytes:11424593 (10.8 Mb)


ponce 11-11-2011 06:19 AM

tried this now at home: seems like that error is misleading as the interface responds fine
Code:

# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:1e:ec:05:61:32 
          inet addr:192.168.2.8  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:46 Base address:0x6000
# ifconfig -v eth1:0 up 192.168.3.2 netmask 255.255.255.0
SIOCSIFFLAGS: Cannot assign requested address
WARNING: at least one error occured. (-1)
# ifconfig eth1:0
eth1:0    Link encap:Ethernet  HWaddr 00:1e:ec:05:61:32 
          inet addr:192.168.3.2  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Interrupt:46 Base address:0x6000
# ping 192.168.3.2
PING 192.168.3.2 (192.168.3.2) 56(84) bytes of data.
64 bytes from 192.168.3.2: icmp_req=1 ttl=64 time=0.048 ms
64 bytes from 192.168.3.2: icmp_req=2 ttl=64 time=0.049 ms
^C
--- 192.168.3.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.048/0.048/0.049/0.007 ms

EDIT: sorry, gotta correct myself, the error was given because I added (?) the "up" string when I assigned the alias: without that no errors at all.
maybe, also for you, it's only a matter of omitting the "up".

yenn 11-14-2011 05:13 PM

Well, the "SIOCSIFFLAGS: Cannot assign requested address" error was probably caused by my IP address manipulation via ip tool. I tried to set IP address via 'ip' before, in case it would work
Code:

$ ip address add 172.16.172.1/24 dev eth0
[...]
$ ip address delete 172.16.172.1/24 dev eth0

and removing did the trick.

Now I can assign address to eth0:0 and ifconfig recognizes it
Code:

eth0      Link encap:Ethernet  HWaddr 00:1A:4D:6E:B0:99 
          inet addr:1.2.3.4  Bcast:1.2.3.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:4dff:fe6e:b099/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9211629 errors:0 dropped:798 overruns:0 frame:0
          TX packets:1943239 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3906439522 (3725.4 Mb)  TX bytes:275619695 (262.8 Mb)
          Interrupt:41 Base address:0x6000

eth0:0    Link encap:Ethernet  HWaddr 00:1A:4D:6E:B0:99 
          inet addr:172.16.172.1  Bcast:172.16.172.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:41 Base address:0x6000

However, when I try to ping something (MIMO in my case) I get this error
Code:

root@router:~# ping 172.16.172.31
PING 172.16.172.31 (172.16.172.31) 56(84) bytes of data.
ping: sendmsg: Operation not permitted

I experienced similar errors few times before (with routerboard-based AP) and solution was put switch between device and router. This time I can't (and don't want to) put switch between MIMO and router.
Of course I tried Google, but all I came across was "is your cable plugged in?", "does your NIC actually work?", etc. I'm pretty sure wiring and NIC are OK, cause there is working network over eth0, but I can't completely rule out hardware malfunction.

yenn 11-15-2011 08:45 AM

Eventually I figured it out. Firewall rules were causing trouble
Code:

iptables -A OUTPUT -p all -s $outer_ip -j ACCEPT
iptables -A OUTPUT -p all -s $wired_ip -j ACCEPT
iptables -A OUTPUT -p all -s $wifi_ip -j ACCEPT

I simply forgot to add
Code:

iptables -A OUTPUT -p all -s 172.16.172.1 -j ACCEPT
Mystery solved ;) thanks for help!


All times are GMT -5. The time now is 01:38 AM.