Configure Routing on RHEL

Configure Routing Tables on RHEL

Edit the IP Table (one that will be applied permenantly even after reboot)

/etc/sysconfig/network-scripts/route- <interface name>

 

Apply the edited configuration file

/etc/sysconfig/network-scripts/ifup-routes <interface name>

 

Add dynamically (will be erased after reboot)

route add “______”

 

 

 

 

Configure DNAT on Routing Tables on RHEL

Configure with  specific ports

iptables -t nat -A PREROUTING -d 105.90.15.131 -p tcp –dport 22 -j DNAT –to-destination 172.26.1.131:22

 

Configured without port

iptables -t nat -A PREROUTING -d 105.90.15.131 -j DNAT –to-destination 172.26.1.131

iptables -t nat -A PREROUTING -d 105.90.15.130 -j DNAT –to-destination 172.26.1.130

 

Deleting the DNAT with port

iptables -t nat -D PREROUTING -d 105.90.15.131 -p tcp –dport 22 -j DNAT –to-destination 172.26.1.131:22

 

Deleting the DNAT without port

iptables -t nat -nL OUTPUT –line-numbers

iptables -t nat -D OUTPUT {number-here}