Having two different networks
My computer is connected two networks, one is company network (internet) over WiFi, so I can not change my IP address or other settings on this network, second is a local LAN network to which my computer is connected with cable. this local LAN has a router and I can change settings on this cabled-network. But If I activate both networks at the same time, internet connection does not work any more. If I unplug the local LAN cable or deactivate it, then internet connection over WiFi works. I have read somewhere that, If you have two different networks, then all settings should be manual, I mean IP addresses, gateways, netmasks etc. Since I can not change these settins of WiFi network, how can I have working 2 networks?
As I understand from your question, your internet access works via WiFi and not via LAN. And you get your LAN connection settings via DHCP from your LAN router.
To access the internet you need to have the "default route" set to the router connected to the internet. Probably your LAN router's DHCP sets your default route to its own address.
As you did not provide any information about your OS (Ubuntu, kubuntu, xubuntu, any other?) it is difficult to give detailed advice. You may open a console terminal and type netstat -nr
, which will give you sort of
Ziel Router Genmask Flags MSS Fenster irtt Iface
0.0.0.0 192.168.192.1 0.0.0.0 UG 0 0 0 enp2s0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 virbr0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
192.168.192.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
(sorry for the german system). What is important is the target (Ziel) 0.0.0.0
, which is the default route (address of the router to use when accessing internet). Try this command once without LAN connected and once with LAN connected and provide the output here for further assistance.
Edit
Depending on what the LAN is for (connecting to other local computers, other networks behind the router), the easiest way to solve the problem would be to switch the LAN settings from "automatic (DHCP)" to "manual".
Start the network manager (should be some icon in your systray; in unity search for it - see the official documentation in the ubuntu wiki here, german version). Locate the connection called something like "Wired connection", select and click on "edit".
In the edit window, switch to tab "IPV4". Change the method from "auto (DHCP)" to "manual". Add a line to the address window (click on "add"). In the address window, enter a fixed address from your LAN and the corresponding netmask; leave the "Gateway" field empty. If there are other computers in your LAN getting their IP addresses via DHCP, make sure to use a fixed IP address outside the DHCP range of the router/DHCP server.
If there are other subnets which you want to reach via your LAN router, you have to add an entry for each of those subnets by clicking on "routes".
Save the changed configuration. Now when you connect the LAN, there will be no default gateway entry added to your routing table.