making routes using config files
Posted: 2021/03/04 21:03:17
i try to figure out how to control traffic between 4 virtual machines using routing, preferably using configfiles instead of issuing commands in terminal.
Can i be told where i go wrong please?
. .
Step by step of what i tried:
1.
I try to set all ip:s by editing
/etc/sysconfig/network-scripts/ifcfg-Auto_eth0
/etc/sysconfig/network-scripts/ifcfg-Auto_eth1
/etc/sysconfig/network-scripts/ifcfg-Auto_eth2
2.
Then i edit
/etc/sysctl.conf
changing
net.ifv4.ip_forward = 0
to
net.ifv4.ip_forward = 1
3.
Then either restart the VM or issue "service network restart" in terminal
Seems to be working.
4.
Flush all iptables rules i know of by issuing
iptables -t raw -F
iptables -t security -F
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
(Not a permanent solution.)
5.
Add the file
/etc/sysconfig/network-scripts/route-eth2
And alike for other nics
containing
192.168.2.17/32 via 192.168.2.16 dev eth2
Don't work.
So i issue
ip route add 192.168.2.17/32 via 192.168.2.16 dev eth
this works.
tho i seem to be able to route trough 3 machines but not 4.
I cannot figure out where i go wrong.
Any ideas?
Can i be told where i go wrong please?
. .
Step by step of what i tried:
1.
I try to set all ip:s by editing
/etc/sysconfig/network-scripts/ifcfg-Auto_eth0
/etc/sysconfig/network-scripts/ifcfg-Auto_eth1
/etc/sysconfig/network-scripts/ifcfg-Auto_eth2
2.
Then i edit
/etc/sysctl.conf
changing
net.ifv4.ip_forward = 0
to
net.ifv4.ip_forward = 1
3.
Then either restart the VM or issue "service network restart" in terminal
Seems to be working.
4.
Flush all iptables rules i know of by issuing
iptables -t raw -F
iptables -t security -F
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
(Not a permanent solution.)
5.
Add the file
/etc/sysconfig/network-scripts/route-eth2
And alike for other nics
containing
192.168.2.17/32 via 192.168.2.16 dev eth2
Don't work.
So i issue
ip route add 192.168.2.17/32 via 192.168.2.16 dev eth
this works.
tho i seem to be able to route trough 3 machines but not 4.
I cannot figure out where i go wrong.
Any ideas?