Need of Two default gateway
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Need of Two default gateway
Hello team,
I am using Centos 8 with two network card.
I tried but still not resolved, I need two default gateway
One card is connected to Pri (sip pri) , as default gateway
second card for local network/internet.
ens128: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.14 netmask 255.255.255.0 broadcast 192.168.1.255
ens133: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.204.55.22 netmask 255.255.255.252 broadcast 10.204.55.23
ens133 using with default gateway
ip route add 192.168.1.0/24 dev ens128 src 192.168.1.14 table rt2
ip route add default via 192.168.1.1 dev ens128 table rt2
ip rule add from 192.168.1.14/32 table rt2
ip rule add to 192.168.1.14/32 table rt2
cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 rt2
pls guide
I am using Centos 8 with two network card.
I tried but still not resolved, I need two default gateway
One card is connected to Pri (sip pri) , as default gateway
second card for local network/internet.
ens128: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.14 netmask 255.255.255.0 broadcast 192.168.1.255
ens133: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.204.55.22 netmask 255.255.255.252 broadcast 10.204.55.23
ens133 using with default gateway
ip route add 192.168.1.0/24 dev ens128 src 192.168.1.14 table rt2
ip route add default via 192.168.1.1 dev ens128 table rt2
ip rule add from 192.168.1.14/32 table rt2
ip rule add to 192.168.1.14/32 table rt2
cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 rt2
pls guide
Re: Need of Two default gateway
Lets say that you need to connect to IP x.y.z.w. The x.y.z.w is not in any link-local subnet.
Could there be x.y.z.w in both Pri and internet?
Which interface should the outgoing packet use?
Could there be x.y.z.w in both Pri and internet?
Which interface should the outgoing packet use?
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Re: Need of Two default gateway
thanks for reply
ens133: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.204.55.22 netmask 255.255.255.252 broadcast 10.204.55.23
above network is belong to its gateway 10.204.55.21 and 10.232.130.170 only for connectivity with Airtel Pri service provider.
My internet for all other work/services should work with second network . 192.168.1.14
ens133: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.204.55.22 netmask 255.255.255.252 broadcast 10.204.55.23
above network is belong to its gateway 10.204.55.21 and 10.232.130.170 only for connectivity with Airtel Pri service provider.
My internet for all other work/services should work with second network . 192.168.1.14
Re: Need of Two default gateway
Code: Select all
$ ipcalc -n -b -p 10.204.55.22 255.255.255.252
PREFIX=30
BROADCAST=10.204.55.23
NETWORK=10.204.55.20
* 10.204.55.20 network address
* 10.204.55.21 router
* 10.204.55.22 your machine
* 10.204.55.23 broadcast address
If I understood correctly, the address 10.232.130.170 should be reached through router 10.204.55.21.
You don't need default route to reach 10.232.130.170.
You can use a static route: 10.232.130.170 via 10.204.55.21
Are there any other addresses that are behind router 10.204.55.21?
If you know them, then you could add static routes for them too.
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Re: Need of Two default gateway
thanks for reply.
pls guide to create static route file for same as you understand.
I am waiting for final setting for my both card to go ahead as per requirement.
thanks
pls guide to create static route file for same as you understand.
I am waiting for final setting for my both card to go ahead as per requirement.
thanks
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Re: Need of Two default gateway
Hello , following is my current list
0.0.0.0 via 192.168.1.1 dev ens128 proto static metric 102
default via 10.204.55.21 dev ens133 proto static metric 101
default via 192.168.1.1 dev ens128 proto static metric 102
10.204.55.20/30 dev ens133 proto kernel scope link src 10.204.55.22 metric 101
10.232.130.170 via 10.204.55.21 dev ens133 proto static metric 101
142.250.71.46 via 192.168.1.1 dev ens128 proto static metric 102
142.250.71.48 via 192.168.1.1 dev ens128 proto static metric 102
164.100.88.149 via 192.168.1.1 dev ens128 proto static metric 102
164.100.213.171 via 192.168.1.1 dev ens128 proto static metric 102
192.168.1.0/24 dev ens128 proto kernel scope link src 192.168.1.14 metric 102
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
202.153.32.16 via 192.168.1.1 dev ens128 proto static metric 102
I am using static routes as of now , I want to use internet through 192.168 network.
My default gateway would be default via 10.204.55.21 , connected with Pri line
I tried few nmcli commands but still need solution
pls see
thanks
0.0.0.0 via 192.168.1.1 dev ens128 proto static metric 102
default via 10.204.55.21 dev ens133 proto static metric 101
default via 192.168.1.1 dev ens128 proto static metric 102
10.204.55.20/30 dev ens133 proto kernel scope link src 10.204.55.22 metric 101
10.232.130.170 via 10.204.55.21 dev ens133 proto static metric 101
142.250.71.46 via 192.168.1.1 dev ens128 proto static metric 102
142.250.71.48 via 192.168.1.1 dev ens128 proto static metric 102
164.100.88.149 via 192.168.1.1 dev ens128 proto static metric 102
164.100.213.171 via 192.168.1.1 dev ens128 proto static metric 102
192.168.1.0/24 dev ens128 proto kernel scope link src 192.168.1.14 metric 102
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
202.153.32.16 via 192.168.1.1 dev ens128 proto static metric 102
I am using static routes as of now , I want to use internet through 192.168 network.
My default gateway would be default via 10.204.55.21 , connected with Pri line
I tried few nmcli commands but still need solution
pls see
thanks
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Re: Need of Two default gateway
ping yahoo.com -I 192.168.1.14
PING yahoo.com (74.6.231.20) from 192.168.1.14 : 56(84) bytes of data.
not working.
PING yahoo.com (74.6.231.20) from 192.168.1.14 : 56(84) bytes of data.
not working.
Re: Need of Two default gateway
You want to use 192.168 network, i.e. you want to send to other networks via 192.168.1.1. That is the default.
Which basically means that you only need these routes:
Code: Select all
default via 192.168.1.1
10.204.55.20/30 dev ens133 proto kernel scope link src 10.204.55.22 metric 101
10.232.130.170 via 10.204.55.21
192.168.1.0/24 dev ens128 proto kernel scope link src 192.168.1.14 metric 102
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
Code: Select all
nmcli con mod ens133 ipv4.gateway ""
necessary x via 10.204.55.21 routes.
-
- Posts: 12
- Joined: 2021/02/09 13:57:36
Re: Need of Two default gateway
Thanks for reply,
Issue is ens133 is connected to PRI line (Sip Pri) , and its need default connection.
if I undefault same , pri line trop working properly.
So In this case , default would be always ens133 and I need to use internet for second network.
Can we use iptables for my issue, pls guide .
Issue is ens133 is connected to PRI line (Sip Pri) , and its need default connection.
if I undefault same , pri line trop working properly.
So In this case , default would be always ens133 and I need to use internet for second network.
Can we use iptables for my issue, pls guide .