How do I configure two network adapters in Ubuntu Server?
I have two network adapters. How do I setup both adapters in Ubuntu Server for squid?
- Adapter 1 (ip=192.168.2.100 subnet 255.255.255.0 default gateway 192.168.2.1)
- Adapter 2 for my network switch which is connected to my user.
server networking
migrated from serverfault.com Nov 6 '11 at 15:10
This question came from our site for system and network administrators.
add a comment |
I have two network adapters. How do I setup both adapters in Ubuntu Server for squid?
- Adapter 1 (ip=192.168.2.100 subnet 255.255.255.0 default gateway 192.168.2.1)
- Adapter 2 for my network switch which is connected to my user.
server networking
migrated from serverfault.com Nov 6 '11 at 15:10
This question came from our site for system and network administrators.
add a comment |
I have two network adapters. How do I setup both adapters in Ubuntu Server for squid?
- Adapter 1 (ip=192.168.2.100 subnet 255.255.255.0 default gateway 192.168.2.1)
- Adapter 2 for my network switch which is connected to my user.
server networking
I have two network adapters. How do I setup both adapters in Ubuntu Server for squid?
- Adapter 1 (ip=192.168.2.100 subnet 255.255.255.0 default gateway 192.168.2.1)
- Adapter 2 for my network switch which is connected to my user.
server networking
server networking
edited Feb 4 '12 at 1:50
Bill the Lizard
405614
405614
asked Nov 6 '11 at 15:03
Hassnat Ahmad
migrated from serverfault.com Nov 6 '11 at 15:10
This question came from our site for system and network administrators.
migrated from serverfault.com Nov 6 '11 at 15:10
This question came from our site for system and network administrators.
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Had a similar issue with 2/two networking devices on Ubuntu 12.04 and apt-get wouldn't resolve any remote host address however, I was able to accept incoming connections. After tons of searching and coming across this post, I had tried the above once before and didn't seem to work.
Not sure if I had made another change since the first time trying to add the gateway option however, after trying to add the gateway option again I was unable to connect to my Webmin interface, which is assigned/bound to (one ip / one interface), however was able to get apt-get update to resolve domains again and ping remote hosts.
To get Webmin accessible again I removed the gateway option from the network card used for the Webmin interface in the /etc/network/interfaces
file.
Not sure if I have some other misconfiguration somewhere else that could be causing that to happen, but for now it works and if I find a better solution I will re-post.
My interfaces file :
# The loopback network interface
auto lo eth1 etho
iface lol inet loopback
# The Primary network interface
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
broadcast 255.255.255.255
network 192.168.0.0
eth1 is for Apache server and is on-board 10/1000 Mb/s
eth0 is an add-in card 10/100 Mb/s for local ssh, webmin, etc...
They appear in that order as well.
Thanks!
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
add a comment |
That's difficult to read, but I think you asked how to set up two network cards. Here is some help for static addressing. Edit the interfaces file and restart networking. Use your favorite text editor to...
sudo vim /etc/network/interfaces
And the contents of the file:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.2.99
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
Save and restart networking:
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include thegateway
portion for the second NIC
– puk
Nov 13 '13 at 23:07
add a comment |
for ubuntu 16.04 LTS server: two steps
- assuming eno1 is your primary network interface which also has internet access, update your interfaces file by "sudo nano /etc/network/interfaces" to following (change ip address to what is your 2nd network ip address):
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet dhcp
auto enp2s0
iface enp2s0 inet static
address 192.167.0.150
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
- sudo reboot
add a comment |
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.3.99
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
in ubuntu 16.04 am also trying to aad two different network in two nic but after editing the network configuration file(vim /etc/network/interfaces), am trying to restart the netwok it won't work and i didnt get the self ping also .....can you please help me to resove this
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f76065%2fhow-do-i-configure-two-network-adapters-in-ubuntu-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Had a similar issue with 2/two networking devices on Ubuntu 12.04 and apt-get wouldn't resolve any remote host address however, I was able to accept incoming connections. After tons of searching and coming across this post, I had tried the above once before and didn't seem to work.
Not sure if I had made another change since the first time trying to add the gateway option however, after trying to add the gateway option again I was unable to connect to my Webmin interface, which is assigned/bound to (one ip / one interface), however was able to get apt-get update to resolve domains again and ping remote hosts.
To get Webmin accessible again I removed the gateway option from the network card used for the Webmin interface in the /etc/network/interfaces
file.
Not sure if I have some other misconfiguration somewhere else that could be causing that to happen, but for now it works and if I find a better solution I will re-post.
My interfaces file :
# The loopback network interface
auto lo eth1 etho
iface lol inet loopback
# The Primary network interface
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
broadcast 255.255.255.255
network 192.168.0.0
eth1 is for Apache server and is on-board 10/1000 Mb/s
eth0 is an add-in card 10/100 Mb/s for local ssh, webmin, etc...
They appear in that order as well.
Thanks!
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
add a comment |
Had a similar issue with 2/two networking devices on Ubuntu 12.04 and apt-get wouldn't resolve any remote host address however, I was able to accept incoming connections. After tons of searching and coming across this post, I had tried the above once before and didn't seem to work.
Not sure if I had made another change since the first time trying to add the gateway option however, after trying to add the gateway option again I was unable to connect to my Webmin interface, which is assigned/bound to (one ip / one interface), however was able to get apt-get update to resolve domains again and ping remote hosts.
To get Webmin accessible again I removed the gateway option from the network card used for the Webmin interface in the /etc/network/interfaces
file.
Not sure if I have some other misconfiguration somewhere else that could be causing that to happen, but for now it works and if I find a better solution I will re-post.
My interfaces file :
# The loopback network interface
auto lo eth1 etho
iface lol inet loopback
# The Primary network interface
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
broadcast 255.255.255.255
network 192.168.0.0
eth1 is for Apache server and is on-board 10/1000 Mb/s
eth0 is an add-in card 10/100 Mb/s for local ssh, webmin, etc...
They appear in that order as well.
Thanks!
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
add a comment |
Had a similar issue with 2/two networking devices on Ubuntu 12.04 and apt-get wouldn't resolve any remote host address however, I was able to accept incoming connections. After tons of searching and coming across this post, I had tried the above once before and didn't seem to work.
Not sure if I had made another change since the first time trying to add the gateway option however, after trying to add the gateway option again I was unable to connect to my Webmin interface, which is assigned/bound to (one ip / one interface), however was able to get apt-get update to resolve domains again and ping remote hosts.
To get Webmin accessible again I removed the gateway option from the network card used for the Webmin interface in the /etc/network/interfaces
file.
Not sure if I have some other misconfiguration somewhere else that could be causing that to happen, but for now it works and if I find a better solution I will re-post.
My interfaces file :
# The loopback network interface
auto lo eth1 etho
iface lol inet loopback
# The Primary network interface
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
broadcast 255.255.255.255
network 192.168.0.0
eth1 is for Apache server and is on-board 10/1000 Mb/s
eth0 is an add-in card 10/100 Mb/s for local ssh, webmin, etc...
They appear in that order as well.
Thanks!
Had a similar issue with 2/two networking devices on Ubuntu 12.04 and apt-get wouldn't resolve any remote host address however, I was able to accept incoming connections. After tons of searching and coming across this post, I had tried the above once before and didn't seem to work.
Not sure if I had made another change since the first time trying to add the gateway option however, after trying to add the gateway option again I was unable to connect to my Webmin interface, which is assigned/bound to (one ip / one interface), however was able to get apt-get update to resolve domains again and ping remote hosts.
To get Webmin accessible again I removed the gateway option from the network card used for the Webmin interface in the /etc/network/interfaces
file.
Not sure if I have some other misconfiguration somewhere else that could be causing that to happen, but for now it works and if I find a better solution I will re-post.
My interfaces file :
# The loopback network interface
auto lo eth1 etho
iface lol inet loopback
# The Primary network interface
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
broadcast 255.255.255.255
network 192.168.0.0
eth1 is for Apache server and is on-board 10/1000 Mb/s
eth0 is an add-in card 10/100 Mb/s for local ssh, webmin, etc...
They appear in that order as well.
Thanks!
edited Apr 26 '17 at 8:19
pa4080
14.7k52872
14.7k52872
answered Oct 11 '12 at 23:59
toystorytoystory
6411512
6411512
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
add a comment |
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
5
5
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
Shouldn't your broadcast be 192.168.0.255?
– Ernestas
Sep 9 '13 at 16:10
add a comment |
That's difficult to read, but I think you asked how to set up two network cards. Here is some help for static addressing. Edit the interfaces file and restart networking. Use your favorite text editor to...
sudo vim /etc/network/interfaces
And the contents of the file:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.2.99
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
Save and restart networking:
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include thegateway
portion for the second NIC
– puk
Nov 13 '13 at 23:07
add a comment |
That's difficult to read, but I think you asked how to set up two network cards. Here is some help for static addressing. Edit the interfaces file and restart networking. Use your favorite text editor to...
sudo vim /etc/network/interfaces
And the contents of the file:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.2.99
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
Save and restart networking:
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include thegateway
portion for the second NIC
– puk
Nov 13 '13 at 23:07
add a comment |
That's difficult to read, but I think you asked how to set up two network cards. Here is some help for static addressing. Edit the interfaces file and restart networking. Use your favorite text editor to...
sudo vim /etc/network/interfaces
And the contents of the file:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.2.99
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
Save and restart networking:
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
That's difficult to read, but I think you asked how to set up two network cards. Here is some help for static addressing. Edit the interfaces file and restart networking. Use your favorite text editor to...
sudo vim /etc/network/interfaces
And the contents of the file:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.2.99
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
Save and restart networking:
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
answered Dec 10 '11 at 0:02
user8290
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include thegateway
portion for the second NIC
– puk
Nov 13 '13 at 23:07
add a comment |
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include thegateway
portion for the second NIC
– puk
Nov 13 '13 at 23:07
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
How does Ubuntu know which one should it use for traffic?
– Ernestas
Sep 9 '13 at 16:11
Any reason why some people/tutorials don't include the
gateway
portion for the second NIC– puk
Nov 13 '13 at 23:07
Any reason why some people/tutorials don't include the
gateway
portion for the second NIC– puk
Nov 13 '13 at 23:07
add a comment |
for ubuntu 16.04 LTS server: two steps
- assuming eno1 is your primary network interface which also has internet access, update your interfaces file by "sudo nano /etc/network/interfaces" to following (change ip address to what is your 2nd network ip address):
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet dhcp
auto enp2s0
iface enp2s0 inet static
address 192.167.0.150
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
- sudo reboot
add a comment |
for ubuntu 16.04 LTS server: two steps
- assuming eno1 is your primary network interface which also has internet access, update your interfaces file by "sudo nano /etc/network/interfaces" to following (change ip address to what is your 2nd network ip address):
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet dhcp
auto enp2s0
iface enp2s0 inet static
address 192.167.0.150
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
- sudo reboot
add a comment |
for ubuntu 16.04 LTS server: two steps
- assuming eno1 is your primary network interface which also has internet access, update your interfaces file by "sudo nano /etc/network/interfaces" to following (change ip address to what is your 2nd network ip address):
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet dhcp
auto enp2s0
iface enp2s0 inet static
address 192.167.0.150
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
- sudo reboot
for ubuntu 16.04 LTS server: two steps
- assuming eno1 is your primary network interface which also has internet access, update your interfaces file by "sudo nano /etc/network/interfaces" to following (change ip address to what is your 2nd network ip address):
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet dhcp
auto enp2s0
iface enp2s0 inet static
address 192.167.0.150
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
- sudo reboot
edited Aug 15 '17 at 12:18
dev93
338
338
answered Aug 15 '16 at 11:21
Gurmeet SinghGurmeet Singh
163
163
add a comment |
add a comment |
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.3.99
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
in ubuntu 16.04 am also trying to aad two different network in two nic but after editing the network configuration file(vim /etc/network/interfaces), am trying to restart the netwok it won't work and i didnt get the self ping also .....can you please help me to resove this
New contributor
add a comment |
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.3.99
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
in ubuntu 16.04 am also trying to aad two different network in two nic but after editing the network configuration file(vim /etc/network/interfaces), am trying to restart the netwok it won't work and i didnt get the self ping also .....can you please help me to resove this
New contributor
add a comment |
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.3.99
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
in ubuntu 16.04 am also trying to aad two different network in two nic but after editing the network configuration file(vim /etc/network/interfaces), am trying to restart the netwok it won't work and i didnt get the self ping also .....can you please help me to resove this
New contributor
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
auto eth1
iface eth1 inet static
address 192.168.3.99
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
in ubuntu 16.04 am also trying to aad two different network in two nic but after editing the network configuration file(vim /etc/network/interfaces), am trying to restart the netwok it won't work and i didnt get the self ping also .....can you please help me to resove this
New contributor
New contributor
answered 28 mins ago
AbuAbu
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f76065%2fhow-do-i-configure-two-network-adapters-in-ubuntu-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown