How to customize network interfaces on Linux

Description

This article will explain how to customize and set network interfaces on Linux to run with CHARON. All commands are given as an example, configuration can be done using other tools.


If you use the Charon Linux Toolkit, you must set the ifcfg file name to match the network interface name (in some cases this is not true).

Examples:

  • If the network interface name is "charon", the ifcfg file name must be "ifcfg-charon"
  • If the network interface name is "ens33", the ifcfg file name must be "ifcfg-ens33"


Related Linux distributions and versions:

  • Red Hat Enterprise Linux 7 and CentOS 7 for management and CHARON dedicated interfaces
  • Red Hat Enterprise Linux 6 for CHARON dedicated interfaces only (due to some restrictions)

Step-by-step guide

(blue star) The examples below assume the NetworkManager service is active.

In the examples below, we assume we have a server with 3 Network Interfaces Cards (NIC), 1 dedicated for management with static IP address and the 2 others for CHARON.

The management interface will be named "stromasys" and the 2 others will be named "charon_pluto" and "charon_nix".

Do not give the name "internet" to the management interface if you plan to do so with Red Hat 6 (don't use this name for DEVICE and NAME parameters) because it will make the NIC not recognized.

At first step, we can see the 3 interfaces settings:

ifconfig command:

# ifconfig -a

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:7e:b3:91  txqueuelen 1000  (Ethernet)
        RX packets 625  bytes 70149 (68.5 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:7e:b3:9b  txqueuelen 1000  (Ethernet)
        RX packets 627  bytes 70323 (68.6 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

ens35: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:7e:b3:a5  txqueuelen 1000  (Ethernet)
        RX packets 627  bytes 70421 (68.7 KiB)
        RX errors 0  dropped 14  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 642  bytes 55180 (53.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 642  bytes 55180 (53.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

nmcli command:

# nmcli con
NAME   UUID                                  TYPE            DEVICE
ens35  64673e9c-a5a9-4929-83b9-3326592de052  802-3-ethernet  --    
ens34  5ffd7abd-747c-4878-9d41-9b4fcefd3f4e  802-3-ethernet  --    
ens33  993835bc-dac8-4f74-84d0-b265dc281c7b  802-3-ethernet  --    

# nmcli dev
DEVICE  TYPE      STATE         CONNECTION
ens33   ethernet  disconnected  --        
ens34   ethernet  disconnected  --        
ens35   ethernet  disconnected  --        
lo      loopback  unmanaged     --

We will now rename the interface names and devices, will assign an IP address to the management NIC and will set the 2 others to run with CHARON.

Move to the /etc/sysconfig/network-scripts folder and rename the ifcfg-ens33 file to ifcfg-stromasys for example.

(info) We've decided to use ifcfg-ens33 because the content of that file shows the MAC address (HWADDR line) corresponds to the one we've decided to use

# cd /etc/sysconfig/network-scripts/

# ls ifcfg-*
ifcfg-ens33  ifcfg-ens34  ifcfg-ens35  ifcfg-lo

# cat ifcfg-ens33
HWADDR=00:0C:29:7E:B3:91
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=993835bc-dac8-4f74-84d0-b265dc281c7b
ONBOOT=no

# mv ifcfg-ens33 ifcfg-stromasys

# vi ifcfg-stromasys
...

# cat ifcfg-stromasys
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=stromasys
DEVICE=stromasys
UUID=993835bc-dac8-4f74-84d0-b265dc281c7b
ONBOOT=yes
HWADDR=00:0C:29:7E:B3:91
DNS1=192.168.151.250
IPADDR=192.168.152.120
PREFIX=24
GATEWAY=192.168.152.1

# ls ifcfg-*
ifcfg-ens34  ifcfg-ens35  ifcfg-lo  ifcfg-stromasys

# mv ifcfg-ens34 ifcfg-charon_pluto

# vi ifcfg-charon_pluto
...

# cat ifcfg-charon_pluto
HWADDR=00:0C:29:7E:B3:9B
UUID=5ffd7abd-747c-4878-9d41-9b4fcefd3f4e
NAME=charon_pluto
DEVICE=charon_pluto
NM_CONTROLLED=no
ONBOOT=no

# mv ifcfg-ens35 ifcfg-charon_nix

# vi ifcfg-charon_nix
...

# cat ifcfg-charon_nix
HWADDR=00:0C:29:7E:B3:A5
UUID=64673e9c-a5a9-4929-83b9-3326592de052
NAME=charon_nix
DEVICE=charon_nix
NM_CONTROLLED=no
ONBOOT=no

# reboot

(info) The "nmcli con reload" command (available with Red Hat 7) is not enough to make the DEVICE names change so a reboot is required  

After the reboot we can see the new settings:

# ifconfig -a
charon_nix: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:29:7e:b3:a5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

charon_pluto: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:29:7e:b3:9b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 134  bytes 11568 (11.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 134  bytes 11568 (11.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

stromasys: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.152.120  netmask 255.255.255.0  broadcast 192.168.152.255
        inet6 fe80::20c:29ff:fe7e:b391  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:7e:b3:91  txqueuelen 1000  (Ethernet)
        RX packets 152  bytes 17435 (17.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 69  bytes 7577 (7.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# nmcli con
NAME       UUID                                  TYPE            DEVICE    
stromasys  993835bc-dac8-4f74-84d0-b265dc281c7b  802-3-ethernet  stromasys

# nmcli dev
DEVICE        TYPE      STATE      CONNECTION
stromasys     ethernet  connected  stromasys  
charon_nix    ethernet  unmanaged  --         
charon_pluto  ethernet  unmanaged  --         
lo            loopback  unmanaged  --

# ping 192.168.152.212
PING 192.168.152.212 (192.168.152.212) 56(84) bytes of data.
64 bytes from 192.168.152.212: icmp_seq=1 ttl=64 time=0.087 ms
64 bytes from 192.168.152.212: icmp_seq=2 ttl=64 time=0.065 ms
64 bytes from 192.168.152.212: icmp_seq=3 ttl=64 time=0.088 ms
^C
--- 192.168.152.212 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.065/0.080/0.088/0.010 ms

(warning) All CHARON dedicated NICs must have their offloading parameters disabled, see the CHARON product related documentation / Installation chapter and Network configuration

Links

Red Hat Enterprise Linux 6 - Interface Configuration Files

Red Hat Enterprise Linux 7 - IP Networking

Related articles

and:



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.