Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

My physical server A has two interfaces: eth0 and eth1. I intend to enable the two network interfaces both for internet in ubuntu12.04. I configure the /etc/network/interfaces as below:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
auto eth1
iface eth1 inet static

And the output of ifconfig is shown below:

eth0      Link encap:Ethernet  HWaddr e0:db:55:25:ed:10
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::e2db:55ff:fe25:ed10/64 Scope:Link
          RX packets:1148531 errors:0 dropped:0 overruns:0 frame:0
          TX packets:554215 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1636019748 (1.6 GB)  TX bytes:40068201 (40.0 MB)

eth1      Link encap:Ethernet  HWaddr e0:db:55:25:ed:11
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::e2db:55ff:fe25:ed11/64 Scope:Link
          RX packets:56699 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4077879 (4.0 MB)  TX bytes:492 (492.0 B)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:124891 errors:0 dropped:0 overruns:0 frame:0
          TX packets:124891 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1484482588 (1.4 GB)  TX bytes:1484482588 (1.4 GB)

So, I think both the 2 network interfaces are up. However, I find I can access my physical server A from host B only via eth0(, and fail to access it via eth1(

When I use route -n to check the router table in my server, it shows:

vli05@vli05:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 eth0   U     0      0        0 eth0   U     0      0        0 eth1

What am I doing wrong?

PS: The host B I am using ping command is in the same subnet of the physical host A I mentioned above. I just want to use ping to access the physical host A both via eth0( and eth1(

Besides, the Output of $ sudo netstat -tapn | grep :22 is shown below:

tcp        0      0    *               LISTEN                           1180/sshd
tcp        0      0       ESTABLISHED                      13235/sshd: zjuvlis
tcp6       0      0 :::22                   :::*                    LISTEN

In this case, I am using host with IP to ssh But I fail to ssh corresponding IP of eth1)

What's more, when I debug using telnet,

root@CO:/home/dujun/work_git/Ruby_reference/trace_ruby_code# telnet 22
Connected to
Escape character is '^]'.

The result is same as telent 22

share|improve this question
By "access", do you mean ssh? http? ping? What net is the host you're trying to connect from on? – Mark Plotnick Feb 19 '14 at 12:56
@Mark access means ping. The host I am using is in the same subnet of the remote host. – user2886717 Feb 19 '14 at 13:11
I think you cannot use two interfaces to access one destination at the same time in the same system. But it would be really interesting to specify an interface to reach a given destination. I faced the same issue when i tried to connect to LAN using ETH0 interface and the WEB using a WWAN interface in the same time without enabling/desabling. May be it's what you looking for also. – Slyx Feb 19 '14 at 13:41
I am sorry for my confusing wording. I intend to access HOST A from B. A has two network interfaces. I find only one netwrok interface work. I want another network interface work too(I want to ping the corresponding IP address). I re-edited my questions. – user2886717 Feb 19 '14 at 13:49
@Slyx - you can def. set this up to permit access, but it needs to be setup right 8-) – slm Feb 19 '14 at 14:34

1 Answer 1

Your networking setup seems fine to me.


In order to "access" a server over both IP addresses you've set up you need to make sure that SSH is accepting connections on both and is "bound" to both IP addresses.

If SSH is listening on all the IP addresses that are present on your system then you should see it bound to the special IP This means any/all interfaces that are present on the system that have an IP associated with it.


$ sudo netstat -tapn | grep :22
tcp        0      0*         LISTEN      3540/sshd
tcp6       0      0 :::22           :::*               LISTEN      3540/sshd

Debugging further

When attempting to SSH to this host you could use the command telnet to debug if this host is accepting connections on port 22 (SSH's TCP/IP port) on both IP addresses to confirm that it's accepting connections. You could be getting tripped up by a firewall rule (such as by iptables).

To confirm just do these to commands from another host:

$ telnet 22
$ telnet 22

When these work you'll see output like this:

Connected to
Escape character is '^]'.

NOTE: Use Control+] to break out of this.

share|improve this answer
@user2886717 - please explain your issue now? How are you not able to connect? – slm Feb 19 '14 at 14:31
My question is that: can you give me an example on how to configure 2 network interfaces in a ubuntu host? I want both 2 network interfaces work, both can access Internet and I can access host from outside via these 2 network interfaces. – user2886717 Feb 20 '14 at 11:39
@user2886717 - when you say acess internet, you mean from the system over either NIC out to the internet right? Because inbound (ssh) seems to be working. – slm Feb 20 '14 at 12:49
yeah, you are right. – user2886717 Feb 20 '14 at 12:57
@user2886717 - what do you expect the outbound traffic to do? The routing rules dictate which interface to use when a packet is being routed. So if you've designated the subnet of NIC #1 ( as your default gateway (UG in route output) then any packets that don't match the other rules, goes out over that NIC only. If you want to use both of them you'll need to do something more complicated. – slm Feb 20 '14 at 13:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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