0

Suppose I configure my ethernet network interface in /etc/network/interfaces with a static IP in this way for example:

auto enp7s0
iface enp7s0 inet static
    address 192.168.0.200
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8

Suppose no cable is connected and I connect my computer, via network manager, to a wifi network with the same ip address range (192.168.0.X) and DHCP (this is interface is not the one defined above). In this mode I cannot access the internet, there is a kind of conflicts in this, but why? Thank you

0

Even without the cable connected, your computer will assign that static address to enp7s0. Check the output of route -n and you will probably find out the the traffic in the range 192.168.0.X is routed through the enp7s0 interface.

You can fix the routing or you can turn down the cable interface if you are not using it with:

sudo ifconfig enp7s0 down

I think that it should fix the problem.

  • Yes, that fixes.. but I still not understand why it happens.. Is it not possible to have two interfaces active at the same time on two different networks with the same ip address range? – rok Apr 14 '17 at 11:21
  • It is possible and I think that that's what you have. The problem seems to be that you are routing the internet traffic through the interface that you have disconnected. That's why it won't go online. Check how to add and delete routes in Linux if you want to customize your settings for two interfaces in two different networks. – Katu Apr 14 '17 at 11:24
  • I wonder if allow-hotplug would help? it should bring the interface up when a cable is connected - but I'm not sure if it also takes it down when disconnected. Another option might be to use metric to route via the wireless interface preferentially. – steeldriver Apr 14 '17 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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