network monitor
net-tools (Stop maintain)
procfs
ioctl
iproute2
netlink
Show all interface state
ifconfig -a
ip li sh
Enable/Disable interface link
sudo ifconfig $interface_name up/down
sudo ip link set up/down $interface_name
Assign ip address //iproute2 could give one more address to a link (ifconfig need to give alias)
sudo ifconfig $interface_name $ipaddr_with_mask
sudo ip addr add $ipaddr_with_mask dev $interface_name
alias ip 1. sudo vconfig add $interface_name $vlan 2. sudo ifconfig $interface_name.$vlan:1 $ip1 3. sudo ifconfig $interface_name.$vlan:2 $ip2
Remove ip address
sudo ifconfig $interface_name 0
sudo ip addr del $ip_addr dev $interface_name
Show interface ip address
ifconfig $interface_name (Show only one address)
ip addr show dev $interface_name
Show ipv6 address
ifconfig $interface_name (Show only one address)
ip -6 addr show dev $interface_name
Assign ipv6 address
sudo ifconfig $interface_name inet6 add $ipv6_addr_with_mask
sudo ip -6 addr add $ipv6_addr_mask dev $interface_name
Remove ipv6 address
sudo ifconfig $interface_name inet6 del $ipv6_addr_with_mask
sudo ip -6 addr del $ipv6_addr_with_mask dev $interface_name
Modify MAC address
sudo ifconfig $interface_name hw ether $MAC
sudo ip link set dev $interface_name address $MAC
List Routing Table
route -an (netstat -rn)
ip ro sh (ip route show)
Add and modify default route
sudo route add default gw $gw_ip $interface_name $ sudo route del default gw $gw_ip $interface_name
sudo ip route add default via $gw_ip dev $interface_name $ sudo ip route replace default via $gw_ip dev $interface_name
Add and remove static route
sudo route add -net 172.16.32.0/24 gw 192.168.1.1 dev eth0 $ sudo route del -net 172.16.32.0/24
sudo ip route add 172.16.32.0/24 via 192.168.1.1 dev eth0 $ sudo ip route del 172.16.32.0/24
Check network state
netstate
ss -l
List ARP table
arp -an
ip neigh
Add static arp
sudo arp -s 192.168.1.100 00:0c:29:c0:5a:ef $ sudo arp -d 192.168.1.100
sudo ip neigh add 192.168.1.100 lladdr 00:0c:29:c0:5a:ef dev eth0 $ sudo ip neigh del 192.168.1.100 dev eth0
Last updated
Was this helpful?