Dual Network Gateway on CentOS 6.7
I have dual NIC machine running CentOS 6.7 and asterisk. First NIC is for LAN & Internet connectivity and second is for trunk provider's connectivity. Both of these have gateways configured. I don't seem to be able to access the Internet as the traffic is routed thru the Second NIC's gateway, also the second NIC is taken as default route by the kernel. I do not understand how default gateway is assigned in this case and what correction should I do.
Eth0 Config:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.100
DNS1=8.8.8.8
DNS2=8.8.4.4
Eth1 Config:
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.165.11.139
NETMASK=255.255.255.248
GATEWAY=10.165.11.137
Ping Internet
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.165.11.137 icmp_seq=1 Destination Net Unreachable
Ping SIP Trunk
ping 10.232.130.170
PING 10.232.130.170 (10.232.130.170) 56(84) bytes of data.
64 bytes from 10.232.130.170 (10.232.130.170): icmp_seq=1 ttl=253 time=3.14 ms
Routing Table
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.165.11.136 * 255.255.255.248 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
default 10.165.11.137 0.0.0.0 UG 0 0 0 eth1
centos networking route asterisk sip
add a comment |
I have dual NIC machine running CentOS 6.7 and asterisk. First NIC is for LAN & Internet connectivity and second is for trunk provider's connectivity. Both of these have gateways configured. I don't seem to be able to access the Internet as the traffic is routed thru the Second NIC's gateway, also the second NIC is taken as default route by the kernel. I do not understand how default gateway is assigned in this case and what correction should I do.
Eth0 Config:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.100
DNS1=8.8.8.8
DNS2=8.8.4.4
Eth1 Config:
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.165.11.139
NETMASK=255.255.255.248
GATEWAY=10.165.11.137
Ping Internet
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.165.11.137 icmp_seq=1 Destination Net Unreachable
Ping SIP Trunk
ping 10.232.130.170
PING 10.232.130.170 (10.232.130.170) 56(84) bytes of data.
64 bytes from 10.232.130.170 (10.232.130.170): icmp_seq=1 ttl=253 time=3.14 ms
Routing Table
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.165.11.136 * 255.255.255.248 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
default 10.165.11.137 0.0.0.0 UG 0 0 0 eth1
centos networking route asterisk sip
add a comment |
I have dual NIC machine running CentOS 6.7 and asterisk. First NIC is for LAN & Internet connectivity and second is for trunk provider's connectivity. Both of these have gateways configured. I don't seem to be able to access the Internet as the traffic is routed thru the Second NIC's gateway, also the second NIC is taken as default route by the kernel. I do not understand how default gateway is assigned in this case and what correction should I do.
Eth0 Config:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.100
DNS1=8.8.8.8
DNS2=8.8.4.4
Eth1 Config:
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.165.11.139
NETMASK=255.255.255.248
GATEWAY=10.165.11.137
Ping Internet
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.165.11.137 icmp_seq=1 Destination Net Unreachable
Ping SIP Trunk
ping 10.232.130.170
PING 10.232.130.170 (10.232.130.170) 56(84) bytes of data.
64 bytes from 10.232.130.170 (10.232.130.170): icmp_seq=1 ttl=253 time=3.14 ms
Routing Table
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.165.11.136 * 255.255.255.248 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
default 10.165.11.137 0.0.0.0 UG 0 0 0 eth1
centos networking route asterisk sip
I have dual NIC machine running CentOS 6.7 and asterisk. First NIC is for LAN & Internet connectivity and second is for trunk provider's connectivity. Both of these have gateways configured. I don't seem to be able to access the Internet as the traffic is routed thru the Second NIC's gateway, also the second NIC is taken as default route by the kernel. I do not understand how default gateway is assigned in this case and what correction should I do.
Eth0 Config:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.100
DNS1=8.8.8.8
DNS2=8.8.4.4
Eth1 Config:
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.165.11.139
NETMASK=255.255.255.248
GATEWAY=10.165.11.137
Ping Internet
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.165.11.137 icmp_seq=1 Destination Net Unreachable
Ping SIP Trunk
ping 10.232.130.170
PING 10.232.130.170 (10.232.130.170) 56(84) bytes of data.
64 bytes from 10.232.130.170 (10.232.130.170): icmp_seq=1 ttl=253 time=3.14 ms
Routing Table
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.165.11.136 * 255.255.255.248 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
default 10.165.11.137 0.0.0.0 UG 0 0 0 eth1
centos networking route asterisk sip
centos networking route asterisk sip
edited Jan 1 at 21:46
Rui F Ribeiro
39.4k1479131
39.4k1479131
asked Jan 1 at 18:29
user1263746user1263746
2013517
2013517
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Edit the eth1 config file and comment out/delete the gateway line and restart network service as follows:
service network restart
Now you should see 192.168.0.100 as your default router and everything should be working as expected.
By default, all the traffic related with the subnet of the eth1 interface, will go through that interface because the kernel will create that entry.
It's good to mention that all the traffic (except 10.165.11.136/255.255.255.248), will go through your default gateway, but in case you want to route some specific traffic through eth1 interface you can do as follows:
Runtime:
ip route add X.X.X.X/32 via 10.165.11.137 dev eth1
Permanent:
- Create the file
/etc/sysconfig/network-script/route-eth1
Add a line like this
X.X.X.X/32 via 10.165.11.137
Restart network service to apply
service network restart
I hope this helps.
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491907%2fdual-network-gateway-on-centos-6-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Edit the eth1 config file and comment out/delete the gateway line and restart network service as follows:
service network restart
Now you should see 192.168.0.100 as your default router and everything should be working as expected.
By default, all the traffic related with the subnet of the eth1 interface, will go through that interface because the kernel will create that entry.
It's good to mention that all the traffic (except 10.165.11.136/255.255.255.248), will go through your default gateway, but in case you want to route some specific traffic through eth1 interface you can do as follows:
Runtime:
ip route add X.X.X.X/32 via 10.165.11.137 dev eth1
Permanent:
- Create the file
/etc/sysconfig/network-script/route-eth1
Add a line like this
X.X.X.X/32 via 10.165.11.137
Restart network service to apply
service network restart
I hope this helps.
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
add a comment |
Edit the eth1 config file and comment out/delete the gateway line and restart network service as follows:
service network restart
Now you should see 192.168.0.100 as your default router and everything should be working as expected.
By default, all the traffic related with the subnet of the eth1 interface, will go through that interface because the kernel will create that entry.
It's good to mention that all the traffic (except 10.165.11.136/255.255.255.248), will go through your default gateway, but in case you want to route some specific traffic through eth1 interface you can do as follows:
Runtime:
ip route add X.X.X.X/32 via 10.165.11.137 dev eth1
Permanent:
- Create the file
/etc/sysconfig/network-script/route-eth1
Add a line like this
X.X.X.X/32 via 10.165.11.137
Restart network service to apply
service network restart
I hope this helps.
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
add a comment |
Edit the eth1 config file and comment out/delete the gateway line and restart network service as follows:
service network restart
Now you should see 192.168.0.100 as your default router and everything should be working as expected.
By default, all the traffic related with the subnet of the eth1 interface, will go through that interface because the kernel will create that entry.
It's good to mention that all the traffic (except 10.165.11.136/255.255.255.248), will go through your default gateway, but in case you want to route some specific traffic through eth1 interface you can do as follows:
Runtime:
ip route add X.X.X.X/32 via 10.165.11.137 dev eth1
Permanent:
- Create the file
/etc/sysconfig/network-script/route-eth1
Add a line like this
X.X.X.X/32 via 10.165.11.137
Restart network service to apply
service network restart
I hope this helps.
Edit the eth1 config file and comment out/delete the gateway line and restart network service as follows:
service network restart
Now you should see 192.168.0.100 as your default router and everything should be working as expected.
By default, all the traffic related with the subnet of the eth1 interface, will go through that interface because the kernel will create that entry.
It's good to mention that all the traffic (except 10.165.11.136/255.255.255.248), will go through your default gateway, but in case you want to route some specific traffic through eth1 interface you can do as follows:
Runtime:
ip route add X.X.X.X/32 via 10.165.11.137 dev eth1
Permanent:
- Create the file
/etc/sysconfig/network-script/route-eth1
Add a line like this
X.X.X.X/32 via 10.165.11.137
Restart network service to apply
service network restart
I hope this helps.
answered Jan 1 at 19:18
Manuel FlorianManuel Florian
364
364
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
add a comment |
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
I tried removed gateway from eth1, I can ping 10.165.11.137 (gateway), but 10.232.130.170 (remote host) is surprisingly not reachable. ip route add X.X.X.X/32 via 10.165.11.137 dev eth1, how do I make this generic for all 255 hosts of 10.232.130.X subnet?
– user1263746
Jan 1 at 20:00
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
@user1263746 The IP 10.232.130.170 is out the subnet of eth1 interface. You should add a route. Something like this: ip route add 10.232.130.0/24 via 10.165.11.137 dev eth1.
– Manuel Florian
Jan 1 at 20:11
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491907%2fdual-network-gateway-on-centos-6-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown