0

Given: CentOS 6 computer working as default gateway for local net. Its internal net is 10.20.30.0/24, 10.20.30.1 is its IP address.

Problem: I need to set up static route to another network (i.e. 10.40.10.0/24), via gateway 10.20.30.5 (in the same internal net).

When I add static route on any local system, i.e.

Linux:
route add -net 10.40.10.0/24 gw 10.20.30.5 
Windows:
route add 10.40.10.0 mask 255.255.255.0 10.20.30.5

it works fine. However, I see no obvious way to add corresponding routing on default gateway only, to avoid adding static routes on every local computer.

If I do on default gateway something like

ip route add 10.40.10.0/24 via 10.20.30.5 dev eth1

(eth1 is where 10.20.30.0/24 works), I see ICMP Ping traveling back and forth to 10.40.10.0/24, but all other communication with that network times out.

Updated: as requested in comments:

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 10:xx:xx:xx:xx:5a brd ff:ff:ff:ff:ff:ff
    inet 8x.yy.zz.a/24 brd 8x.yy.zz.255 scope global eth0
    inet 8x.yy.zz.b/24 brd 8x.yy.zz.255 scope global secondary eth0:0
    inet 8x.yy.zz.c/24 brd 8x.yy.zz.255 scope global secondary eth0:1
    inet6 fe80::xxxx:yyyy:zzzz:tttt/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 1c:xx:yy:zz:tt:32 brd ff:ff:ff:ff:ff:ff
    inet 10.20.30.1/24 brd 10.20.30.255 scope global eth1
    inet 10.21.0.1/16 brd 10.21.255.255 scope global eth1:0
    inet6 fe80::xxxx:yyyy:zzzz:tttt/64 scope link 
       valid_lft forever preferred_lft forever

# cat /proc/sys/net/ipv4/ip_forward
1
  • 1
    Can you post your network configuration? ip addr and cat /proc/sys/net/ipv4/ip_forward – Alessandro Carini Jan 5 '17 at 10:32
  • @Alessandro Carini Done, post updated. – Konstantin Boyandin Jan 6 '17 at 11:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.