SkillPilotAI

nameif, plipconfig, slattach, iptunnel, vconfig, ifenslave

Six legacy Linux interface tools from net-tools, vlan and ifenslave: nameif (rename by MAC), plipconfig (PLIP timing), slattach (serial line as a network interface), iptunnel (IPIP/GRE/SIT tunnels), vconfig (802.1Q VLANs) and ifenslave (bonding). You still meet them on old systems and in interviews, together with their iproute2 replacements.

29.1 Tools and their modern replacements

ToolWhat it doesModern replacement
nameifRenames an interface by MAC (/etc/mactab)ip link set eth1 name lan0; systemd .link files / udev rules
plipconfigTunes PLIP timing over the parallel portObsolete: use Ethernet / USB
slattachTurns a serial line into a SLIP/CSLIP interfacepppd
iptunnelCreates IPIP, GRE, SIT tunnelsip tunnel add
vconfigCreates 802.1Q VLAN devices (deprecated)ip link add ... type vlan id N
ifenslaveAttaches NICs to a bondip link set eth1 master bond0
  • Linux only (not on macOS or Windows). Lab: Docker namespaces a (Site A), b (Site B) and srv on br0 192.168.49.0/24.

29.2 nameif: rename by MAC

  • nameif NEWNAME MAC renames the interface with that MAC; the interface must be down first.
  • With no arguments it reads /etc/mactab (name MAC per line); -c FILE uses another file; several pairs at once are allowed.
  • Unknown MAC: 'interface not found', exit 1; -s (syslog) hides the message but still exits 1.
Terminal
ip link set eth1 downnameif lan0 02:49:00:00:00:11ip link set lan0 upip -br link show lan0echo 'wan0 02:49:00:00:00:12' \  > /etc/mactabip link set eth2 down; nameif# /etc/mymactab: uplink0 02:49:00:00:00:12nameif -c /etc/mymactabnameif lan1 02:49:00:00:00:11 \  wan1 02:49:00:00:00:12nameif bad0 02:49:00:00:00:99nameif -s bad0 02:49:00:00:00:99
Output
$ ip -br link show eth1eth1@eth2        UP             02:49:00:00:00:11 <BROADCAST,MULTICAST,UP,LOWER_UP>$ nameif lan0 02:49:00:00:00:11$ ip link set lan0 up; ip -br link show lan0lan0@eth2        UP             02:49:00:00:00:11 <BROADCAST,MULTICAST,UP,LOWER_UP>$ cat /etc/mactabwan0 02:49:00:00:00:12$ ip link set eth2 down; nameif; ip -br link show wan0wan0@lan0        DOWN           02:49:00:00:00:12 <BROADCAST,MULTICAST>$ ip link set wan0 down; nameif -c /etc/mymactab; ip -br link show uplink0uplink0@lan0     DOWN           02:49:00:00:00:12 <BROADCAST,MULTICAST>$ nameif lan1 02:49:00:00:00:11 wan1 02:49:00:00:00:12; ip -br link | grep -E 'lan1|wan1'wan1@lan1        DOWN           02:49:00:00:00:12 <BROADCAST,MULTICAST,M-DOWN>lan1@wan1        DOWN           02:49:00:00:00:11 <BROADCAST,MULTICAST,M-DOWN>$ nameif bad0 02:49:00:00:00:99; echo exit=$?interface 'bad0' not foundexit=1$ nameif -s bad0 02:49:00:00:00:99; echo exit=$?exit=1

29.3 plipconfig and slattach

  • plipconfig IF [nibble NN] [trigger NN] tunes PLIP (IP over the parallel port); the lab kernel has no CONFIG_PARPORT, so 'ioctl: No such device'.
  • slattach puts a serial tty into a network line discipline: -p slip|cslip(default)|adaptive|kiss|tty, -s speed, -L 3-wire, -e exit after init, -d debug.
  • In the lab a socat pty pair acted as the serial cable; SLIP failed because CONFIG_SLIP is not set.
  • slattach -p ppp prints 'Sorry, use pppd!'; -p tty puts the line back to normal.
Terminal
plipconfig -Vplipconfig -hplipconfig plip0plipconfig plip0 nibble 2000 trigger 300zcat /proc/config.gz \  | grep -E 'CONFIG_(PARPORT|PLIP)[ =]'
Output
$ plipconfig -Vnet-tools 2.10John Paul Morrison, Alan Cox et al.$ plipconfig -hUsage: plipconfig interface [nibble NN] [trigger NN]       plipconfig -V | --version$ plipconfig plip0; echo exit=$?ioctl: No such device$ plipconfig plip0 nibble 2000 trigger 300; echo exit=$?ioctl: No such device$ zcat /proc/config.gz | grep -E 'CONFIG_(PARPORT|PLIP)[ =]'# CONFIG_PARPORT is not set
Terminal
socat pty,raw,echo=0,link=/tmp/ttyA \  pty,raw,echo=0,link=/tmp/ttyB &slattach -Vslattach -d -p slip -s 115200 -L /tmp/ttyAzcat /proc/config.gz \  | grep -E 'CONFIG_SLIP[ =]|CONFIG_SLHC'slattach -p ppp -e /tmp/ttyAslattach -d -p tty -e /tmp/ttyA
Output
$ ls -l /tmp/ttyA /tmp/ttyBlrwxrwxrwx    1 root     root            10 Nov  8 17:07 /tmp/ttyA -> /dev/pts/0lrwxrwxrwx    1 root     root            10 Nov  8 17:07 /tmp/ttyB -> /dev/pts/1$ slattach -Vnet-tools 2.10$ slattach -d -p slip -s 115200 -L /tmp/ttyAslattach: tty_open: /tmp/ttyA (fd=3)slattach: tty_set_speed: 115200slattach: tty_set_databits: 8slattach: tty_set_parity: NSLIP_set_disc(1): Invalid argumentexit=1$ zcat /proc/config.gz | grep -E 'CONFIG_SLIP[ =]|CONFIG_SLHC'# CONFIG_SLIP is not setCONFIG_SLHC=m$ slattach -p ppp -e /tmp/ttyA; echo exit=$?Sorry, use pppd!exit=1$ slattach -d -p tty -e /tmp/ttyA; echo exit=$?slattach: tty_open: /tmp/ttyA (fd=3)slattach: tty_set_speed: 0exit=0

29.4 iptunnel: GRE, IPIP and SIT tunnels

GRE tunnel: a packet inside a packet
  1. 1.Site A pings 10.10.10.2 (private tunnel network)

  2. 2.gre1 adds a GRE header (key 1001) and a new outer IP header

  3. 3.Outer packet 192.168.49.1 -> 192.168.49.2 crosses the internet (lab: br0)

  4. 4.Site B checks the GRE key and removes the outer header

  5. 5.Original ping is delivered; the reply returns the same way

tcpdump shows proto GRE (47) outside and ICMP 10.10.10.1 > 10.10.10.2 inside

Terminal
iptunnel -V# Site A (namespace a):iptunnel add gre1 mode gre \  remote 192.168.49.2 local 192.168.49.1 \  ttl 255 key 1001ip addr add 10.10.10.1/30 dev gre1ip link set gre1 up# Site B: remote/local swapped, 10.10.10.2/30iptunnel show gre1ping -c 2 10.10.10.2tcpdump -ni br0 -c 2 -v ip proto 47
Output
$ iptunnel -Vnet-tools 2.10Alexey Kuznetsov$ ip netns exec a iptunnel show gre1gre1: gre/ip  remote 192.168.49.2  local 192.168.49.1  ttl 255  key 0.0.3.233$ ip netns exec a ping -c 2 10.10.10.264 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=7.97 ms64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.107 ms2 packets transmitted, 2 received, 0% packet loss, time 1000ms$ tcpdump -ni br0 -c 2 -v ip proto 4717:07:37.973930 IP (tos 0x0, ttl 255, id 10087, offset 0, flags [DF], proto GRE (47), length 112)    192.168.49.1 > 192.168.49.2: GREv0, Flags [key present], key=0x3e9, length 92	IP (tos 0x0, ttl 64, id 12677, offset 0, flags [DF], proto ICMP (1), length 84)    10.10.10.1 > 10.10.10.2: ICMP echo request, id 315, seq 1, length 64
ParameterMeaning
mode ipip | gre | sitIPv4 in IPv4 / Cisco GRE / IPv6 in IPv4 (6in4)
remote / local ADDR|anyFar end / own source address
ikey / okey / key KGRE key in / out / both (shown as dotted, 1001 = 0.0.3.233)
iseq/oseq/seq, icsum/ocsum/csumGRE sequencing and checksums
ttl N | inherit, tos N | inheritFixed outer TTL/TOS or copy from the inner packet
nopmtudisc, dev eth0PMTU discovery off; bind to a physical device
Terminal
iptunnel change gre1 mode gre \  remote 192.168.49.2 local 192.168.49.1 \  ttl 64 key 1001iptunnel add tun0 mode ipip \  remote 192.168.49.2 local 192.168.49.1 \  ttl inheritiptunnel add sit1 mode sit \  remote 192.168.49.2 local 192.168.49.1 \  ttl 64iptunnel showiptunnel del tun0iptunnel del sit1iptunnel help
Output
$ ip netns exec a iptunnel showgre0: gre/ip  remote any  local any  ttl inherit  nopmtudisc key 0.0.0.0tunl0: unknown/ip  remote any  local any  ttl inherit  nopmtudiscsit0: ipv6/ip  remote any  local any  ttl 64  nopmtudiscgre1: gre/ip  remote 192.168.49.2  local 192.168.49.1  ttl 64  key 0.0.3.233tun0: ip/ip  remote 192.168.49.2  local 192.168.49.1  ttl inheritsit1: ipv6/ip  remote 192.168.49.2  local 192.168.49.1  ttl 64$ ip netns exec a iptunnel del tun0; ip netns exec a iptunnel del sit1; ip netns exec a iptunnel show | grep -c .4$ iptunnel help 2>&1 | head -6Usage: iptunnel { add | change | del | show } [ NAME ]          [ mode { ipip | gre | sit } ] [ remote ADDR ] [ local ADDR ]          [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]          [ ttl TTL ] [ tos TOS ] [ nopmtudisc ] [ dev PHYS_DEV ]       iptunnel -V | --version

29.5 vconfig: 802.1Q VLANs

  • vconfig add eth0 100 creates eth0.100; frames on the wire carry an 802.1Q tag (ethertype 0x8100, vlan 100).
  • set_egress_map / set_ingress_map map skb priority to VLAN PCP and back; set_flag IF 1 0 turns REORDER_HDR off.
  • set_name_type picks naming (eth0.100, vlan200 ...); rem deletes a VLAN device. /proc/net/vlan/ shows config.
Terminal
# on both Site A and Site B:vconfig add eth0 100ip addr add 10.100.0.1/24 dev eth0.100ip link set eth0.100 upcat /proc/net/vlan/configping -c 2 10.100.0.2tcpdump -eni br0 -c 2 'vlan 100 and icmp'
Output
$ ip netns exec a cat /proc/net/vlan/configVLAN Dev name	 | VLAN IDName-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PADeth0.100       | 100  | eth0$ ip netns exec a ping -c 2 10.100.0.264 bytes from 10.100.0.2: icmp_seq=1 ttl=64 time=0.958 ms64 bytes from 10.100.0.2: icmp_seq=2 ttl=64 time=0.150 ms$ tcpdump -eni br0 -c 2 'vlan 100 and icmp'17:08:10.762798 96:57:77:86:6a:bb > 7e:d5:1c:d0:d9:d4, ethertype 802.1Q (0x8100), length 102: vlan 100, p 0, ethertype IPv4 (0x0800), 10.100.0.1 > 10.100.0.2: ICMP echo request, id 426, seq 1, length 6417:08:10.762948 7e:d5:1c:d0:d9:d4 > 96:57:77:86:6a:bb, ethertype 802.1Q (0x8100), length 102: vlan 100, p 0, ethertype IPv4 (0x0800), 10.100.0.2 > 10.100.0.1: ICMP echo reply, id 426, seq 1, length 64
Terminal
vconfig set_egress_map eth0.100 3 5vconfig set_ingress_map eth0.100 3 5cat /proc/net/vlan/eth0.100vconfig set_flag eth0.100 1 0ip -d link show eth0.100vconfig set_name_type VLAN_PLUS_VID_NO_PADvconfig add eth0 200vconfig rem vlan200
Output
$ ip netns exec a cat /proc/net/vlan/eth0.100eth0.100  VID: 100	 REORDER_HDR: 1  dev->priv_flags: 81001INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:3  6:0 7:0 EGRESS priority mappings: 3:5$ ip -n a -d link show eth0.100 | grep -o 'vlan protocol.*'vlan protocol 802.1Q id 100 <REORDER_HDR>$ ip netns exec a vconfig set_flag eth0.100 1 0; ip -n a -d link show eth0.100 | grep -o 'vlan protocol.*'vlan protocol 802.1Q id 100$ ip netns exec a vconfig set_name_type VLAN_PLUS_VID_NO_PAD$ ip netns exec a vconfig add eth0 200; ip -n a -br link | grep vlanvlan200@eth0     DOWN           96:57:77:86:6a:bb <BROADCAST,MULTICAST>$ ip netns exec a vconfig rem vlan200; ip -n a -br link | grep -c vlan2000

29.6 ifenslave: bonding

Active-backup bond failover
  1. 1.srv has eth0 + eth1 as slaves of bond0 (192.168.49.10)

  2. 2.Traffic from Site A uses eth0 (active slave)

  3. 3.eth0 cable is pulled: MII monitor (miimon 100) sees link down

  4. 4.Bonding driver makes eth1 the active slave

  5. 5.Next packets use eth1; ping keeps working (0% loss)

  • ifenslave MASTER SLAVE... enslaves; -c changes the active slave; -d detaches; -f forces; -a shows all.
  • The lab used BusyBox ifenslave (-c, -d, -f).
Terminal
ip link add bond0 type bond \  mode active-backup miimon 100ip addr add 192.168.49.10/24 dev bond0ifenslave bond0 eth0 eth1cat /proc/net/bonding/bond0# eth0 cable pulled:ip link set s0 downcat /proc/net/bonding/bond0ping -c 2 192.168.49.10   # from Site Aifenslave -c bond0 eth0ifenslave -d bond0 eth1
Output
$ ip netns exec srv ifenslave bond0 eth0 eth1$ ip netns exec srv grep -E 'Mode|Currently|Slave Interface|MII Status' /proc/net/bonding/bond0Bonding Mode: fault-tolerance (active-backup)Currently Active Slave: eth0Slave Interface: eth0Slave Interface: eth1$ ip link set s0 down$ ip netns exec srv grep -E 'Currently|MII Status' /proc/net/bonding/bond0Currently Active Slave: eth1MII Status: upMII Status: downMII Status: up$ ip netns exec a ping -c 2 192.168.49.10 | tail -22 packets transmitted, 2 received, 0% packet loss, time 1030ms$ ip netns exec srv ifenslave -c bond0 eth0; ip netns exec srv grep Currently /proc/net/bonding/bond0Currently Active Slave: eth0$ ip netns exec srv ifenslave -d bond0 eth1; ip netns exec srv grep 'Slave Interface' /proc/net/bonding/bond0Slave Interface: eth0

29.7 Modern iproute2 equivalents

Terminal
ip link set eth1 name lan0ip tunnel add gre1 mode gre remote 192.168.49.2 local 192.168.49.1 key 1001ip link add link eth0 name eth0.100 type vlan id 100ip link add bond0 type bond mode active-backup miimon 100ip link set eth1 master bond0

29.8 Common mistakes

  • Different GRE keys on the two sides (1001 vs 1002): the receiver drops the packets and the ping fails.
  • Thinking a bond doubles the speed of one download: active-backup uses one NIC at a time; LACP/balance raise total throughput, not one flow.
  • Renaming with nameif while the interface is up.
  • Using these deprecated tools in new setups instead of iproute2 + netplan/NetworkManager for persistence.

29.9 Interview tips

  • VLAN today: ip link add link eth0 name eth0.100 type vlan id 100.
  • Bonding today: ip link add bond0 type bond; ip link set eth1 master bond0. Active-backup = redundancy only.
  • Tunnel today: ip tunnel add gre1 mode gre remote ... local ...; GRE is IP protocol 47 and is not encrypted.
  • Naming today: systemd .link files or udev rules; make it persistent with netplan or NetworkManager.