You are not logged in.

#1 2017-01-31 08:59:40

slv
Member
Registered: 2017-01-17
Posts: 37

[Solved]Two interfaces, problem with order

Hello

Some information about my box:

slawek@debian:~$ cat /etc/network/interfaces
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback

slawek@debian:~$ nmcli dev status
URZĄDZENIE  TYP       STAN           POŁĄCZENIE         
eth0        ethernet  połączono      VPN                
eth1        ethernet  połączono      Wired connection 1 
lo          loopback  niezarządzane  --                 


slawek@debian:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:19:99:68:58:d8  
          inet addr:192.168.55.15  Bcast:192.168.55.255  Mask:255.255.255.0
          inet6 addr: fe80::219:99ff:fe68:58d8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:111511 errors:0 dropped:0 overruns:0 frame:0
          TX packets:215250 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6872800 (6.5 MiB)  TX bytes:25488835 (24.3 MiB)

eth1      Link encap:Ethernet  HWaddr 00:80:c8:38:6c:f9  
          inet addr:192.168.25.4  Bcast:192.168.25.255  Mask:255.255.255.0
          inet6 addr: fe80::280:c8ff:fe38:6cf9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:803 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:67597 (66.0 KiB)  TX bytes:1694 (1.6 KiB)


slawek@debian:~$ cat /etc/udev/rules.d/70-persistent-net.rules 

# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:99:68:58:d8", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# USB device 0x:0x (asix)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:80:c8:38:6c:f9", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


slawek@debian:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.55.1    0.0.0.0         UG    1024   0        0 eth0
192.168.25.0    *               255.255.255.0   U     0      0        0 eth1
192.168.55.0    *               255.255.255.0   U     0      0        0 eth0

I have two Ethernet card, one r8169 on mainboard with WoL and second (external) on USB.
I need to start system with embedded nic as a ETH0 with default route on this interface.

I googled for it but I can't find solution. Second problem - my box is far away from me and I have only remote access to it.
Could You help me with it please?

Regards
Slawek

Last edited by slv (2017-02-01 08:58:16)

Offline

#2 2017-01-31 10:16:33

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [Solved]Two interfaces, problem with order

slv wrote:

I need to start system with embedded nic as a ETH0 with default route on this interface

According to the output you have posted, the r8169 card is already assigned to eth0 by the rule in /etc/udev

I'm not sure what you mean by "with default route on this interface" (I've never owned a system with multiple NICs), can you explain further please?

Connection details are usually specified in /etc/network/interfaces

Have you read

man interfaces

“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#3 2017-01-31 22:24:28

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,484

Re: [Solved]Two interfaces, problem with order

I think the simplest way to do this is using systemd-networkd, you can manage even without renaming the ethernet devices, for example:

Create /etc/systemd/network/builtin.network with the following contents (or so, didn't test):

[Match]
MACAddress=00:19:99:68:58:d8
[Network]
Description=Builtin device with default route
# Using static address in this example
Address=192.168.55.15/24
[Route]
Gateway=192.168.55.1
Destination=default
systemctl daemon-reload
systemctl enable systemd-networkd
systemctl start systemd-networkd

You can think of this as a udev dialect for network link/device/route/... configuration. Read systemd.network, systemd.netdev and related man pages to get an overview – but it's very straightforward as you can see.


A silent kite against the blue, blue sky

Online

#4 2017-02-01 08:57:28

slv
Member
Registered: 2017-01-17
Posts: 37

Re: [Solved]Two interfaces, problem with order

Hello

I not very skilled in Linux so I choosed simplest way. I swapped names in /etc/udev/rules.d/70-persis~et.rules (NAME="ethX")

# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:99:68:58:d8", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# USB device 0x:0x (asix)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:80:c8:38:6c:f9", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

and this solved one of my problems.

>According to the output you have posted, the r8169 card is already assigned to eth0 by the rule in /etc/udev

It my mistake, I thought about ETH1 ... but this is solved.

Last edited by slv (2017-02-13 09:57:21)

Offline

Board footer

Powered by FluxBB