0

I have a Raspberry pi 3b, running on "Raspbian GNU/Linux 8 (jessie)" that is currently using a 3G USB dongle to gain internet connectivity. The dongle is a vodafone k5160 set up as an ethernet connection (eth1).

My problem is that whenever i try to connect my rpi to a router on another network using the ethernet port, eth0, it fails to obtain an ip address. It simply gets assigned a random 169.254 local link address, and from reaserching i see that this means it faild to obtain an ip address from the DHCP server. A bit more details on my set up:

  • Raspberry Pi 3b, using vodafone k5160 to gain internet connectivity, which works and has been working with no issues. The dongle is set up as an ethernet interface eth1, with private ip address 192.168.9.0/24

  • I tried to connect my raspberry pi to another router, to communicate with another linux system within the router's network. This was done by connecting a straight trough ethernet cable, from the onboard ethernet port to the router.

  • I have no direct control over the second system i am trying to reach, but i know its ip address within the network. Will be using tcp/ip commands to retrieve data off of this system.

  • The problem i'm having is that my eth0 interface gets assigned a 169.254.0.0/16 link local ip address meaning it failed to obtain one from the router. The expectation was to obtain an ip address within the range of 10.x.x.x.

  • I cannot see or ping the other system, and vice versa. Also, this is a remote application i can't easily play with the hardware (i.e. unplug the dongle, plug in the etherent link, and keep trying different things). I do no directly manage the second system but i can get info if required by the person managing it.

  • Also, as an extra objective, i would like to be able to "split" the traffic between the 2 interfaces. By this i mean to allow to cap the amount of data sent/received by each of these interfaces, and control how much goes through each of these (i hope this makes sense). This is an extra, i would like to focus on my initial issue, and possibly implement this feature once the rest is working.

I received a couple of useful answers prior to my edit to the question. Here is the output of suggested commands to try:

ip route

default via 192.168.9.1 dev eth1  metric 203
169.254.0.0/16 dev eth0  proto kernel  scope link  src 169.254.134.241  metric 202
192.168.9.0/24 dev eth1  proto kernel  scope link  src 192.168.9.100  metric 203

and

ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:e4:f8:66 brd ff:ff:ff:ff:ff:ff
    inet 169.254.134.241/16 brd 169.254.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::d24f:eade:5e86:f087/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
    inet 192.168.9.100/24 brd 192.168.9.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::584f:751f:bb3e:e26b/64 scope link
       valid_lft forever preferred_lft forever
4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT group default qlen 1000
    link/ether b8:27:eb:b1:ad:33 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ba27:ebff:feb1:ad33/64 scope link
       valid_lft forever preferred_lft forever

Thanks.

closed as unclear what you're asking by Milliways, techraf, joan, Steve Robillard, Jacobm001 Feb 26 '18 at 2:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I think this is implied but just to check, does networking work fine when you unplug the USB dongle? Linux should be able to handle having more than one network interface so this doesn't sound like the problem. – Philip Couling Feb 13 '18 at 16:56
  • Without detail of your network settings this is unanswerable; all you get is speculation about possible issues. It is also unclear exactly what you are trying to achieve. – Milliways Feb 13 '18 at 22:29
  • I will add all the details i think could be useful, also based on the answers i received. – LecauseAndThePi Feb 14 '18 at 9:51
  • 1
    The vodafone k5160 dongle established only a connection to internet? There are only eth1 with 192.168.9.100 and the dongle with 192.168.9.1, right? The router behind eth0 has two sides. The side eth0 is connected and the other side the network 10.0.0.0/8 is connected. Now we have to know the ip address of the router on your side (eth0) and if the router established bridging or routing. On bridging we have one network on eth0 and we can reach all hosts there transparently. On routing we have a neighbor network on eth0 and a far network behind the router. Then we have to route into far network. – Ingo Feb 14 '18 at 21:12
  • Yes, the K5160 dongle only connects to the internet, and has 192.168.9.100 ip, on eth1. The Cisco router is connected to the RPI ethernet port. The router provides both local network and internet connectivity (3g router) and 10.0.139.1 ip address. Another system is connected to the router, which has 10.0.139.101 ip address. I'm pretty sure the router does not establish bridging, but rather routing because my rpi should simply connect to the router network and get assigned an IP address within the network. However, the rpi fails to obtain an ip address, and instead assigns itself 169.2540.0/16. – LecauseAndThePi Feb 15 '18 at 9:28
1

This doesn't sound like your problem. Linux can DHCP even when you have multiple network devices with one setup after another.

Either way, to view your routing table open a command line and type:

ip route

You will get something like:

default via 172.31.0.1 dev eth0
172.31.0.0/20 dev eth0 proto kernel scope link src 172.31.3.78

The "default" is where it sends everything not otherwise specified. This doesn't usually apply to the broadcasting used by DHCP, as it can specify which device it wants to broadcast on.

I'd suggest going round and asking another question. Be specific about which version of raspbian and which USB dongle your using. Others may have already had the same problem.

  • Thanks for the answer. It seems that you are correct with your assumptions. ip route gives this output: default via 192.168.9.1 dev eth1 metric 203 169.254.0.0/16 dev eth0 proto kernel scope link src 169.254.134.241 metric 202 192.168.9.0/24 dev eth1 proto kernel scope link src 192.168.9.100 metric 203 So all the traffic, does go through my eth1 interface?. – LecauseAndThePi Feb 14 '18 at 9:46
1

This is a typical multihoming host. Let us assume there is no routing between the two interfaces so your raspi is not a router and we do not enable ip forwarding. For example eth0 is connected to network 192.168.0.0/24 and eth1 is connected 192.168.1.0/24. When eth0 needs an ip address this interface broadcasts into its connected network: "I need an ip address!". If in network 192.168.0.0/24 is a DHCP-Server eth0 will get an ip address, e.g. 192.168.0.10. The same will eth1 do. If in it's network 192.168.1.0/24 is a DHCP-Server it will also get an ip address e.g. 192.168.1.10. If there is missing a DHCP-Server in one of the two networks its interface will not get an ip address. to workaround this you can give eth0 a static (fixed) ip address, or setup a DHDP-Server in each network, or install a DHCP-relay (not easy).

When both interfaces have their ip address and you want to connect to a host with ip address 192.168.0.111 it will automagically go through eth0 (the kernels routing table specifies this). A target host with ip address 192.168.1.111 will go through eth1. This is what you mean with "split the traffic between both interfaces"?

What is with any other target host that have neither an ip address from 192.168.0.0/24 nor from 192.168.1.0/24? They will go to the default route, e.g. default via 192.168.0.1 dev eth0. This specifies the next hop 192.168.0.1, usually your internet router, and the interface it should use.

To check this use the commands:

pi ~$ ip addr
pi ~$ ip route
  • Thank you! I'll edit the post to include a lot more details on my issues. – LecauseAndThePi Feb 14 '18 at 9:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.