# 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
