Page 1 of 1

making routes using config files

Posted: 2021/03/04 21:03:17
by OpenCopperPour
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?

.
VMs network map.txt
(3.23 KiB) Downloaded 758 times
.

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?

Re: making routes using config files

Posted: 2021/03/05 17:32:18
by TrevorH
This doesn't look like it's for CentOS 6 which is the forum you've posted in. Since the ways in which you do this are different on 6 7 and 8, please clarify which CentOS version you are using so that one of us can move this to the correct forum for you.

Re: making routes using config files

Posted: 2021/03/05 18:43:21
by OpenCopperPour
It is actually CentOS 6.10 i'm using on all 4 machines, tho i might have read guides that isnt really CentOS 6.

Can i ask what look like other versions?
Maybe i'll figure out where i go wrong from there.

I'm pretty sure the problem is between the keyboard and chair :D

Noticed your signature about CentOS 6 being dead since november 2020, using 6.10 due to memory constraints.

Re: making routes using config files

Posted: 2021/03/05 18:54:14
by TrevorH
Are you using NetworkManager or the network service? Run rpm -qa NetworkManager\* to find out. It works easily without NM but on the ancient version of NM that was in el6, it's probably a struggle.

Don't forget that you shouldn't be using 6 at all any more. It's EOL and there will be no more updates to it and there are already unfixed serious secrutity problems with it.

Re: making routes using config files

Posted: 2021/03/05 21:49:26
by OpenCopperPour
That gave me, seems like i'm using Networkmanager then i guess.

[root@localhost ~]# rpm -qa NetworkManager\*
NetworkManager-glib-0.8.1-113.el6.x86_64
NetworkManager-0.8.1-113.el6.x86_64
NetworkManager-gnome-0.8.1-113.el6.x86_64
[root@localhost ~]#

Turned it off, messed things up, had to turn it back on because i didn't manage to set IPs and routes on my own :D
Trying again after a shower.

Re: making routes using config files

Posted: 2021/03/06 01:03:25
by TrevorH
I've shut down my CentOS 6 VM so cannot look. Does yum install NetworkManager-dispatcher-routing-rules work? I'm not sure if NM in CentOS 6 had that package or its functionality.

Re: making routes using config files

Posted: 2021/03/06 09:22:19
by jlehtone
The Vault (for 6) does not have NetworkManager-dispatcher-routing-rules. Overall, the NetworkManager for 6 was seriously limited in features. It was about RHEL 7.3 when NM got "sufficient" coverage.

CentOS 6 has two services, 'NetworkManager' and 'network', to configure connections. Both store their config in
the /etc/sysconfig/network-scripts/ifcfg-* files. Both have some GUI/TUI/CLI tools to modify those files.
It is possible (and was common) to modify the files by hand (text editor), but then you have to know the
syntax/format of the files.

Static routes are in separate files. There are two different syntaxes for those files.
I did actually chose an another route: I did set the DHCP server to offer the static routes to clients.
No need for files in clients then.


Why do you seem to have a router in the middle of 192.168.2.x/y ?