Re: Gateway question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi,

You can define your default gateway in "/etc/sysconfig/network" file,

GATEWAY="192.168.1.1"

After that, restart network services.

# systemctl restart network


--Regards
Ashishkumar S. Yadav

On Mon, Aug 8, 2016 at 4:35 PM, Levente Birta <blevi.linux@xxxxxxxxx> wrote:

> Hi
>
> There is a Centos 7 up-to-date box with 2 interfaces, let's say
> 192.168.1.12 - enp2s0, 192.168.1.13 on enp3s0. Default gateway on enp2s0.
>
> The gateway is pfsense, IP is 192.168.1.1 with 2 WAN connections
>
> On the gateway the outgoing traffic is routed by source ip to different
> WAN, 192.168.1.12 to WAN1 and 192.168.1.13 to WAN2
>
> On the centos box are set all the route and routing rules:
>
> route-enp2s0:
> 192.168.1.0/24 dev enp2s0 src 192.168.1.12 table t2
> default via 192.168.1.1 dev enp2s0 table t2
>
> route-enp3s0:
> 192.168.1.0/24 dev enp3s0 src 192.168.1.13 table t3
> default via 192.168.1.1 dev enp3s0 table t3
>
> rule-enp2s0:
> from 192.168.1.12/32 table t2
> to 192.168.1.12/32 table t2
>
> rule-enp3s0:
> from 192.168.1.13/32 table t3
> to 192.168.1.13/32 table t3
>
>
> All work when I add
> #route add default gw 192.168.1.1 dev enp3s0
>
> And that way I have :
>
> # ip route show
> default via 192.168.1.1 dev enp3s0
> default via 192.168.1.1 dev enp2s0
> 169.254.0.0/16 dev enp2s0  scope link  metric 1002
> 169.254.0.0/16 dev enp3s0  scope link  metric 1003
> 192.168.1.0/24 dev enp2s0  proto kernel  scope link  src 192.168.1.12
> 192.168.1.0/24 dev enp3s0  proto kernel  scope link  src 192.168.1.13
>
> But how can I add achieve this only with ip route command ... without
> route?
> Can I add this in any config files (ex: route-enp2s0)?
>
>
>
> Thanks
>
> --
>            Levi
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> https://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux