2 nic 2 gateway
2 nic 2 gateway
Hello to everyone.
I have just installed PBX. I have problem.
Well, I have 2 NIC in the server, eth1 only for SIP with IP 10.1.xx.xx no internet acess, and the other eth0 with 192.168.xx.xx. LAN + Internet.
ifcfg for eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT='yes'
IPADDR=192.168.xx.xx
NETMASK=255.255.255.0
GATEWAY=192.168.xx.xx
ZONE=external
ifcfg for eth1
DEVICE=eth1
BOOTPROTO=static
ONBOOT='yes'
IPADDR=10.1.xx.xx
NETMASK=255.255.255.252
GATEWAY=10.1.xx.xx
ZONE=internal
How to setup one gw for eth0 and another for eth1.
Thanks in advance.
I have just installed PBX. I have problem.
Well, I have 2 NIC in the server, eth1 only for SIP with IP 10.1.xx.xx no internet acess, and the other eth0 with 192.168.xx.xx. LAN + Internet.
ifcfg for eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT='yes'
IPADDR=192.168.xx.xx
NETMASK=255.255.255.0
GATEWAY=192.168.xx.xx
ZONE=external
ifcfg for eth1
DEVICE=eth1
BOOTPROTO=static
ONBOOT='yes'
IPADDR=10.1.xx.xx
NETMASK=255.255.255.252
GATEWAY=10.1.xx.xx
ZONE=internal
How to setup one gw for eth0 and another for eth1.
Thanks in advance.
Re: 2 nic 2 gateway
Don't put a GATEWAY= line in both ifcfg files or the last one to start will set the default route to that and that's not what you want.
You need to create a /etc/sysconfig/network-scripts/route-eth1 file and put ip route add x.x.x.x/yy via gg.aa.te.way/tt] lines in that but without the 'ip route add' portion of that. That will create specific routes for each x.x.x.x/yy subnets that you specify to go via the correct gateway.
You need to create a /etc/sysconfig/network-scripts/route-eth1 file and put ip route add x.x.x.x/yy via gg.aa.te.way/tt] lines in that but without the 'ip route add' portion of that. That will create specific routes for each x.x.x.x/yy subnets that you specify to go via the correct gateway.
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
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
Re: 2 nic 2 gateway
TrevorH, thanks for the quick answer.
Well, i do this.
ifcfg for eth0
new ifcfg for eth1
create route-eth1
And i got this
#netstat -rn
Well, i do this.
ifcfg for eth0
Code: Select all
DEVICE=eth0
BOOTPROTO=static
ONBOOT='yes'
IPADDR=192.168.3.xxx
NETMASK=255.255.255.0
GATEWAY=192.168.3.x
ZONE=external
Code: Select all
DEVICE=eth1
BOOTPROTO=static
ONBOOT='yes'
IPADDR=10.1.19.22
NETMASK=255.255.255.252
ZONE=internal
Code: Select all
10.1.19.22/30 via 10.1.19.21
#netstat -rn
Code: Select all
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.3.x 0.0.0.0 UG 0 0 0 eth0
10.1.19.20 0.0.0.0 255.255.255.252 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
192.168.3.x 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Last edited by milos87 on 2017/03/28 07:54:43, edited 2 times in total.
Re: 2 nic 2 gateway
10.1.19.20 21 22 and 23 are all within 10.1.19.20/30 (which is the same thing as 10.1.19.22/30). It probably doesn't add your route since it already knows it can reach .22 via that interface using the subnet mask. Use ip route get 10.1.19.22 (for example) to see which route it would take to get to your target ip.
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
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
Re: 2 nic 2 gateway
This is what i got
# ip route get 10.1.19.22
But now i have trouble with netmask if i use route-eth1 just like this
#netstat -rn
I also try this for route-eth1 and i lost route.
# ip route get 10.1.19.22
Code: Select all
local 10.1.19.22 dev lo src 10.1.19.22
cache <local>
Code: Select all
10.1.19.22 via 10.1.19.21
Code: Select all
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.3.x 0.0.0.0 UG 0 0 0 eth0
10.1.19.20 0.0.0.0 255.255.255.252 U 0 0 0 eth1
10.1.19.22 10.1.19.21 255.255.255.255 UGH 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
192.168.3.x 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Code: Select all
ADDRESS0=10.1.19.22
NETMASK0=255.255.255.252
GATEWAY0=10.1.19.21
Last edited by milos87 on 2017/03/28 07:53:59, edited 1 time in total.
Re: 2 nic 2 gateway
Wait, .22 appears to be your own ip address?
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
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
Re: 2 nic 2 gateway
My mistake. I copied the wrong eth1 ip adress here. eth1 IPADDR=10.1.19.22TrevorH wrote:Wait, .22 appears to be your own ip address?
Re: 2 nic 2 gateway
That's exactly the same ip address.
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
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