Network Routes

IP routing


==============================
IP Routes
==============================

Lets assume your server's:

Public IP is 50.1.2.3 (as per your example setup)
Public IP Subnet is 50.1.2.0/24
Default Gateway is x.x.x.1
eth0 is device to gateway

Do the following using iproute2:

ip rule add table 128 from 50.1.2.3
ip route add table 128 to 50.1.2.0/24 dev eth0
ip route add table 128 default via x.x.x.1

ip route show
ip route list
route -n
netstat -nr

sudo ip route add 10.0.2.0/24 via 192.168.43.223 dev enp0s3

Where:

10.0.2.0 -> is the network you want to connect to
/24 -> is the subnet mask
192.168.43.223 -> is the IP through which we will reach the server
enp0s3 -> is the network interface


==============================
Blackhole IP:
==============================

# ip route add blackhole xxx.xxx.xx.xx