0

I am currently using GNU/Linux Have the following routing table:

default via 192.168.1.1 dev eno1  proto static  metric 100 
10.0.0.0/8 dev enp1s0  scope link linkdown 
169.254.0.0/16 dev virbr0  scope link  metric 1000 linkdown 
192.168.1.0/24 dev eno1  proto kernel  scope link  src 192.168.1.2  metric 100 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 linkdown 

I use NIC with eno1 to connect to the internet via gateway on subnet 192.168.1.0/24

I use NIC with enp1s0 to act as a NAT gateway(10.0.0.1) for my internal subnet(10.0.0.0/8) Now I want to add(learning purposes) route to 10.0.0.0/8 subnet via my external(eno1) interface:

# Added route via eno1, resulting in routing table shown above
ip route add 10.0.0.0/8 dev enp1s0
# When I add route via enp1s0, command causes error
ip route add 10.0.0.0/8 dev eno1
RTNETLINK answers: File exists

Could you show please how to solve this problem? Thanks.

4
  • Could you be more elaborate? Meaningful rationale would be highly appreciated.
    – anon
    Jan 17, 2017 at 14:15
  • 2
    How does the kernel decide where the packets go to? Your question is a bit similar to "why can't have 2 same named file in one directory?". Jan 17, 2017 at 14:40
  • @Ipor, For example, to make kind of balancing, multipath routing(doesn't know precisely appropriate word), by adding some kind of weight to the route, no?
    – anon
    Jan 17, 2017 at 15:26
  • @Ipor, of course, I just offer you possibility to earn some rep by writing good answer) We are here to help you in good deeds.
    – anon
    Jan 18, 2017 at 6:42

0

You must log in to answer this question.