4

My question looks like a duplicate for this one, but since it has no answers, I will re-ask it with more info. Please take into account that I'm complete beginner in all this networking stuff. I can copy-paste, but I have very vague understanding of what's really happening)

So, I have a home server running Ubuntu 14.04 with two NICs called p2p1 (on motherboard, 100Mb link) and eth0 (via PCI-E, 1000Mb link). And have a samba share, that I would like to use via eth0.

I have connected both interfaces to my gigabit router (ip 192.168.1.1) and using p2p1 to configure server via SSH. Here is ifconfig output:

eth0      Link encap:Ethernet  HWaddr c4:e9:84:03:ee:d0
          inet addr:192.168.1.112  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c6e9:84ff:fe03:eed0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25090 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41728 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3306168 (3.3 MB)  TX bytes:9338018 (9.3 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:583385 errors:0 dropped:0 overruns:0 frame:0
          TX packets:583385 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:105373919 (105.3 MB)  TX bytes:105373919 (105.3 MB)

p2p1      Link encap:Ethernet  HWaddr d0:50:99:6a:5c:5b
          inet addr:192.168.1.105  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::d250:99ff:fe6a:5c5b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48954046 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84807022 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4101748891 (4.1 GB)  TX bytes:114444015383 (114.4 GB)

Then I connect to //192.168.1.112 at my Windows machine and the samba share is opened successfully. I send some ~100MB file and see transfer speed around ~11MB/sec (i.e. 100Mb link speed instead of 1Gb). I check ifconfig counters again and p2p1 is increased by the amount of transferred data, but eth0 is not. loopback interface counters remain the same.

Looks like I'm somehow using eth0 through p2p1.

Another thing that proves hidden bridging is that when I plug out cable from p2p1 interface (ip 192.168.1.105) I cannot connect to 192.168.1.112 ip address.

I googled every way to check whether my interfaces are bridged and how to disable it, but no luck until this moment.

The first thing to check is /etc/network/interfaces. Nothing criminal for me:

auto lo
iface lo inet loopback

auto p2p1
iface p2p1 inet dhcp

auto eth0
iface eth0 inet dhcp

I've checked ip forwarding (just in case)

$ cat /proc/sys/net/ipv4/ip_forward
0

I've checked that there is no interfere with GUI NetworkManager

$ nmcli dev status
DEVICE     TYPE              STATE
p2p1       802-3-ethernet    unmanaged
eth0       802-3-ethernet    unmanaged

One thing I don't like is route -n output. But I'm not a specialist so I don't know whether its ok. Here it is:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 p2p1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 p2p1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

The only difference between my network interfaces is shown by ip addr command. p2p1 have an ipv6 address while eth0 have not. Don't know whether this information is relevant, though:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether c4:e9:84:03:ee:d0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.112/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::c6e9:84ff:fe03:eed0/64 scope link
       valid_lft forever preferred_lft forever
3: p2p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d0:50:99:6a:5c:5b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.105/24 brd 192.168.1.255 scope global p2p1
       valid_lft forever preferred_lft forever
    inet6 fe80::d250:99ff:fe6a:5c5b/64 scope link
       valid_lft forever preferred_lft forever

I don't know what else to check and configure. Any thoughts?

  • Unless smth has been changed last 4 years looking at this answer serverfault.com/a/415749 there is no simple way to fix this... You can bridge the interfaces on both sides (at linux you can easily, but your router could be problematic).... – Rostislav Kandilarov Nov 4 '16 at 17:52
  • If you have "nice" router you can have a look at the dd-wrt and the other derivatives ( open-wrt, tomato, ...list of many others ) for flashing linux on the board... – Rostislav Kandilarov Nov 4 '16 at 17:56
  • This is all very strange for me, but after a reboot packets to 192.168.1.112 are being received by eth0. The other thing I had to check (but didn't) is that Ubuntu firewall (ufw service) somehow got enabled for eth0 only. When I disabled it, everything started to work fine and now I have ~60MB throughput for Samba. Thanks. – d.wsky Nov 5 '16 at 21:27
  • @d.wsky are you tried ifconfig p2p1 down – SuperKrish Nov 7 '16 at 5:51
0

I think i see the problem in here. Since both of your interfaces are on the same subnet and are using DHCP. You can have only one gateway per subnet. From the output of route command, your host is using default route via p2p1 (if this is not what you wanted) instead of eth0.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 p2p1

I am assuming that since both interfaces are using DHCP, whatever interface came up first and got the DHCP lease information prior to another one, assigned itself a gateway and based on that information, linux created default route through that device. Unless it was manually altered.

If you are just willing to use eth0 for all operations, all you have to do is change the default route through eth0. The reason why you are seeing the counters increasing on p2p interface is that since this is default route device, anything entering or leaving will hit this interface.

In short:

  • Change the default route entry to dev eth0. Test if it works as expected. Else:
  • change the IPs to Static instead of DHCP and define gateway only for eth0. Assuming you want to use ssh from the same subnet, on p2p interface. And alter the routing table again.

Here you can find tutorial to add route.

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.