ip in CentOS

Introduction

ip is a more modern and extended version of ifconfig

ip r

ip r

default via 10.0.2.1 dev enp0s3 proto dhcp metric 100 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.18 metric 100 192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.113 metric 101 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1

10.0.2.1 is the IP address of the gateway

ip -n

ip n

192.168.56.100 dev enp0s8 lladdr 08:00:27:0e:02:b4 STALE 10.0.2.1 dev enp0s3 lladdr 52:54:00:12:35:00 STALE 192.168.56.1 dev enp0s8 lladdr 0a:00:27:00:00:00 DELAY 10.0.2.3 dev enp0s3 lladdr 08:00:27:11:93:42 STALE

Create a new namespace

You can create a new network namespace, named, for example, development, with the command

sudo ip netns add development

Check

ip netns

development

Add an IP

You can add an IP to an interface with the command

ip addr add 172.17.67.3/16 dev enp0s8

The IP address is added dynamically, that is, it will disappear after a reboot

Add an IP

You can delete this IP address with the command

ip addr del 172.17.67.3/16 dev enp0s8

Article author: Andrei Olegovich