network conundrum

I have a Pi model B, with a Belkin USB wireless dongle.

With an ethernet cable connected, I can access both the wired and the wireless interfaces.

If I now disconnect the ethernet cable, both interfaces disappear.

/etc/network/interfaces is as follows: ######################################## auto lo iface lo inet loopback

auto eth0 iface eth0 inet static address 192.168.1.91 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1

auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.92 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 broadcast 192.168.1.255

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf ########################################

With the cable connected, at the pi: ######################################## tony@picam0:~$ ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:40:1a:9c inet addr:192.168.1.91 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::ba27:ebff:fe40:1a9c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:162 errors:0 dropped:0 overruns:0 frame:0 TX packets:123 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:17626 (17.2 KiB) TX bytes:14601 (14.2 KiB)

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:65536 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:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

wlan0 Link encap:Ethernet HWaddr 94:44:52:ee:9a:0c inet addr:192.168.1.92 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::9644:52ff:feee:9a0c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:108 errors:0 dropped:1 overruns:0 frame:0 TX packets:112 errors:0 dropped:2 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15634 (15.2 KiB) TX bytes:18814 (18.3 KiB) ######################################## ######################################## tony@picam0:~$ iwconfig wlan0 IEEE 802.11bgn ESSID:"Livebox-2e43" Nickname:"" Mode:Managed Frequency:2.467 GHz Access Point:

00:19:70:3A:D5:9D Bit Rate:65 Mb/s Sensitivity:0/0 Retry:off RTS thr:off Fragment thr:off Power Management:off Link Quality=99/100 Signal level=74/100 Noise level=0/100 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0

lo no wireless extensions.

eth0 no wireless extensions. ########################################

######################################## tony@picam0:~$ sudo wpa_cli status [sudo] password for tony: Selected interface 'wlan0' bssid=00:19:70:3a:d5:9d ssid=Livebox-2e43 id=1 mode=station pairwise_cipher=CCMP group_cipher=TKIP key_mgmt=WPA2-PSK wpa_state=COMPLETED ip_address=192.168.1.92 address=94:44:52:ee:9a:0c ########################################

At the workstation: ######################################## root@tony-fr:~# arp-scan --localnet Interface: eth0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8.1 with 256 hosts

formatting link

192.168.1.1 40:5a:9b:99:2e:43 ANOVO 192.168.1.20 b8:27:eb:a9:96:06 (Unknown) 192.168.1.90 78:a5:dd:08:55:b2 (Unknown) 192.168.1.91 b8:27:eb:40:1a:9c (Unknown) 192.168.1.92 b8:27:eb:40:1a:9c (Unknown) 192.168.1.102 0c:60:76:6c:e6:6f Hon Hai Precision Ind. Co.,Ltd. ########################################

(NOTE that the MAC for the .91 and .92 hosts are identical, despite what ifconfig says.)

Ping to .91 and .92 works as expected, albeit with quite long echo ties from the wireless interface:

root@tony-fr:~# ping picam0 PING picam0 (192.168.1.91) 56(84) bytes of data.

64 bytes from picam0 (192.168.1.91): icmp_req=1 ttl=64 time=1.82 ms

root@tony-fr:~# ping picam0w PING picam0w (192.168.1.92) 56(84) bytes of data.

64 bytes from picam0w (192.168.1.92): icmp_req=1 ttl=64 time=92.4 ms

Now I disconnect the ethernet cable; I would expect the wireless interface to keep working:

root@tony-fr:~# ping picam0w PING picam0w (192.168.1.92) 56(84) bytes of data. ^C

--- picam0w ping statistics ---

6 packets transmitted, 0 received, 100% packet loss, time 5040ms

Bah!

root@tony-fr:~# arp-scan --localnet Interface: eth0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8.1 with 256 hosts

formatting link

192.168.1.1 40:5a:9b:99:2e:43 ANOVO 192.168.1.20 b8:27:eb:a9:96:06 (Unknown) 192.168.1.90 78:a5:dd:08:55:b2 (Unknown) 192.168.1.102 0c:60:76:6c:e6:6f Hon Hai Precision Ind. Co.,Ltd.

Yep, they've BOTH disappeared! Reconnecting the cable brings them both back to life.

No doubt I'm missing something here, but I've been struggling with it for days! Can anyone cast any light, please?

Cheers, Tony

Reply to
Tony van der Hoff
Loading thread data ...

I think you cant have to ifaces in the same net

Try netstat -r or route if both interfaces are on

try a traceroute picam0w and I'm shure you go to picam0w via eth0

Juergen

Reply to
Juergen Schroeder

What you get to life is eth0 only.

The network is confused about is to have two network interfaces in the same subnet but with different addresses. Also, there should be only one default route, now you have two. (Excluding advanced routing with iproute2 or bonding the interfaces).

To try again, move eth0 to another subnet and delete its default route.

--

Tauno Voipio
Reply to
Tauno Voipio

Yes, thanks, that certainly allows the wlan to work.

However, I now can't use eth0. I feel certain that in the past I've used both interfaces on the same device, albeit not simultaneously. I recall the wired system having prececence over the wireless, such that when the cable is plugged in, the wireless gets disabled, and re-enabled when the cable is removed.

That's what I was unsuccessfully trying to replicate.

Reply to
Tony van der Hoff

In the Windows world it is certainly possible to have both wired and wireless interfaces in the same network. Windows chooses which to use for outbound data, and acceptsd inbound on both. Disconnecting one causes a failover to the other.

If Linux cannot do this, it must be an issue with the networking software, not with the concept itself.

--
Alan Adams, from Northamptonshire 
alan@adamshome.org.uk 
http://www.nckc.org.uk/
Reply to
Alan Adams

It's possible in Linux with the correct configuration - it's a bit less "Windows chooses" and a bit more fiddling with scripts that run when an interface comes up or goes down.

Reply to
Rob Morley

I'd like to know the correct configuration...

Reply to
Tony van der Hoff

Maybe a search with Google (or your favourite search engine) would help:

q="two network adapters on same subnet linux"

and number one result shows how to do it!

formatting link

Reply to
mm0fmf

Skimming through it, ISTM there are a couple of things that doesn't address, failover and load balancing (it's ages since I messed with that stuff). Simply setting a default route on both interfaces will leave all outgoing traffic going through the more recently declared one unless the other interface is specified, I think.

Reply to
Rob Morley

Whoa where did failover and load balancing come from? The OP wanted 2 adapters on the same subnet. The link shows how you can do that. Everything else is a deluxe option that is not included in the basic model. You'll be wanting climate control, leather and self-parking for free next!

Reply to
mm0fmf

Failover is just up there ^, from Alan Adams: "Disconnecting one causes a failover to the other."

Load balancing is my contribution: what's the point of having two network interfaces up if you only use one to route out?

Reply to
Rob Morley

"Load balancing" means to me each connection taking a roughly equal and dynamiclly adjusted share of all the traffic. However you could just be routing say YouTube/NetFlix/iPlayer etc over one connection and everything else over the other, that's simple routing not load balancing.

--
Cheers 
Dave.
Reply to
Dave Liquorice

Indeed. You could be running a server on one interface, or connecting to some manner of server, and using the other interface for everything else, but those are specific manual routing choices. That would also complicate the failover scenario.

Reply to
Rob Morley

I think the term missing here is 'routing metrics', which set the precedence of routes. Lower metric = 'cheaper' route. If the lower route goes away, the higher route is used. It's not for load balancing, when the static routing tables are insufficient to decide which outbound route to take.

It's perfectly sensible to have two IPs on the same subnet, you just need to arrange it so that at all times one route to the subnet (ie 192.168.1.*) has priority.

Plus you need a default route via a gateway (which will use the aforementioned subnet route to work out how to get to the gateway). You can in principle use two default routes to different gateways selected via metrics. This might come in handy if you had, say, a DSL connection and a

3G modem and wanted to failover to 3G if the DSL went down.

Theo

Reply to
Theo Markettos

I required it and googled to find if a negative number is also allowed (because I saw that the network route to an interface is created at metric 0 and cannot be undercut except bij negative numbers), and then I read that it is no longer supported in current kernels. There are also other fields (Ref, Use) in the route output that used to be nonzero but have been always zero for a long time now.

(there also used to be a separate "route cache", also gone)

Reply to
Rob

Thanks, Theo.

As the OP, I was severely disappointed at the range of responses so far, ranging from "you can't do that" to "it's difficult" to waffle irrelevant to my question.

Your post has pointed me in the right direction, and a quick google for 'routing metrics' has revealed all sorts of useful and relevant information about my problem. I think I'm now able to set up a system with two interfaces on different addresses.

Thanks again, Tony

Reply to
tony van der Hoff

What, the free suggestions are not good enough? I'd complain to the net-police that you are not getting the quality of free help you believe you are entitled to.

;-)

Reply to
mm0fmf

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.