-1

Quite easy use-case: I have two Ethernet interfaces which should both be connected using DHCP. It does not matter which one the default route is, since it is just a dedicated proof-of-concept setup. However, hot-plugging must work for both interfaces (one of them is a CDC-NCM connection).

connman 1.17 seems only to try to establish a connection to one of the interfaces. If I unplug this connection, DHCP is started on the second interface and everything continues to work. I can connect the second interface always by using “connmanctl connect” manually. But…

… is there any way to configure connman to connect AUTOMATICALLY to both networks via DHCP?

Claudio
  • 10,614
  • 4
  • 31
  • 71
  • Questions on professional server, networking, or related infrastructure administration are off-topic for Stack Overflow unless they directly involve programming or programming tools. You may be able to get help on ServerFault.com. – S.Richmond Dec 03 '13 at 04:12

1 Answers1

1

is there any way to configure connman to connect AUTOMATICALLY to both networks via DHCP?

By default most DHCP servers are configured to issue a default route to the client. If you get two default routes, it's impossible for the linux networking stack to function properly.

Since you would want DHCP clients on both networks to be able to function properly, perhaps the best thing you can do is scan the system routing table and remove one of the default routes.

Typically you'd use netstat -rn to find the duplicate default...

[mpenning@tsunami micro]$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.1.0      0.0.0.0         255.255.255.0   U         0 0          0 eth0
172.16.2.0      0.0.0.0         255.255.255.0   U         0 0          0 eth1
239.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 eth0
0.0.0.0         172.16.1.1      0.0.0.0         UG        0 0          0 eth0 <--
0.0.0.0         172.16.2.1      0.0.0.0         UG        0 0          0 eth1 <--
[mpenning@tsunami micro]$

Then remove one of them...

[mpenning@tsunami micro]$ sudo route del default dev eth1
[mpenning@tsunami micro]$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.1.0      0.0.0.0         255.255.255.0   U         0 0          0 eth0
172.16.2.0      0.0.0.0         255.255.255.0   U         0 0          0 eth1
239.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 eth0
0.0.0.0         172.16.1.1      0.0.0.0         UG        0 0          0 eth0
[mpenning@tsunami micro]$

It's not so hard to write a shell script to check for this issue. However, a better solution is just to get a static address on one of the networks so you don't have to manage around the DHCP issue.

Mike Pennington
  • 41,899
  • 19
  • 136
  • 174