making routes using config files

Issues related to configuring your network
Post Reply
OpenCopperPour
Posts: 3
Joined: 2021/03/04 19:21:26

making routes using config files

Post by OpenCopperPour » 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?

.
VMs network map.txt
(3.23 KiB) Downloaded 725 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?

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: making routes using config files

Post by TrevorH » 2021/03/05 17:32:18

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

OpenCopperPour
Posts: 3
Joined: 2021/03/04 19:21:26

Re: making routes using config files

Post by OpenCopperPour » 2021/03/05 18:43:21

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.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: making routes using config files

Post by TrevorH » 2021/03/05 18:54:14

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

OpenCopperPour
Posts: 3
Joined: 2021/03/04 19:21:26

Re: making routes using config files

Post by OpenCopperPour » 2021/03/05 21:49:26

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.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: making routes using config files

Post by TrevorH » 2021/03/06 01:03:25

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: making routes using config files

Post by jlehtone » 2021/03/06 09:22:19

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 ?

Post Reply