Useful Networking commands in Linux

To get a list/modify the network interfaces on the host run the command:

ip link

To see the IP addresses assigned to the interfaces:

ip addr

Set ip addresses on the interfaces, these will only be valid until the next restart.

ip addr add 192.168.1.10/24 dev eth0

To persist the changes run set them in the /etc/network_interfaces file

Get the ip table route configuration:

ip route

Add to the ip table routing:

ip route add 192.168.1.0/24 via 192.168.2.1

Check if IP forwarding is available on the host:

cat /proc/sys/net/ipv4/ip_forward