How can I set a second network interface in ubuntu 16.04?
Finally I could solve it using the GUI of network-manager. Here are the steps that I followed:
In the network-manager icon at the top-right of the screen click in Open Edit Connections... and then Add and select Ethernet
In the ethernet tab select your network device (enps025 in my case)
Go to IPv4 Settings tab, select manual as method, click in add and fill in the address, netmask and gateway of your internet network. Also fill in DNS servers field if necessary. Save the settings.
Open Edit Connections... again and then Add and select VLAN.
In the VLAN tab fill in the parent interface field with your network device (enps025(XX.XX.XX.XX) in my case). Also fill in your VLAN id.
Then go to IPv4 Settings tab, method = manual, fill in all the field of the network that you are going to use (address,netmask,gateway,dns..).
Finally specify the routes that you want to use through the VLAN network to get access to your servers by clicking in routes in the IPv4 Settings tab. Do not forget to click the option Use this connection only for resources on its network. Save and that's it!!
You can check the network interfaces doing ifconfig. In my case I can see enps025 as the interface for getting internet access and enps025.32 as the vlan interface (32 in the vlan id in my case). If you want to check your routes you can do it by doing netstat -nr
Also it is possible to check/edit the network setting from the command line by editing the files located in /etc/NetworkManager/system-connections/
Related videos on Youtube
dag
Updated on September 18, 2022Comments
-
dag over 1 year
I'm new into networks administration and I'm having some problems...
I'm trying to configure my networks in ubuntu 16.04. The idea is to configure two networks through the same ethernet cable. One of the networks is to have access to internet and the second one is to have access to some servers which I cannot get access from the first network. I have removed network-manager and edited /etc/network/interfaces and it looks like this:
# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback ## Interface configuration for exterior connection auto enp0s25 iface enp0s25 inet static address AAA.AA.AA.AA netmask BBB.BBB.BBB.B gateway CCC.CC.CC.C dns-nameservers DDD.DD.DDD.DDD EEE.EE.EEE.EEE ## Interface configuration for servers connection auto enp0s26 iface enp0s26 inet static address XX.XXX.XX.XX netmask YYY.YYY.YYY.Y gateway ZZ.ZZZ.ZZ.Z dns-nameservers NN.NNN.N.NN
Then I did:
sudo ifup enp0s25
and it worked. Then I tried to ifup enp0s26 in the same way but I couldn't, obtaining the following error:
Cannot find device "enp0s26" Failed to bring up enp0s26.
I have tried everything (reboot, doing networking restart..) but I cannot bring up the second interface. Any idea of how can I solve this problem? Do I need to install some driver? Thanks in advance!
-
user4556274 over 7 yearsenpXXXX refer to physical ethernet interfaces. You cannot configure a device which does not exist on your system. If you do have two interfaces, grep dmesg output for the name of the second device.
-
user4556274 over 7 yearsWhat you may wish to do is create a second vlan on enp0s25.
-
dag over 7 yearsThank you! How can I create the vlan on enp0s25?
-