You are not logged in.

#1 2013-05-13 15:33:09

quayasil
Member
Registered: 2008-11-09
Posts: 112

[SOLVED] simple routing - what have I forgotten??

Forgive me that simple question. Didn't do it manually for years. I'm missing something obvious. Sclerosis... :-(

On comp1:

# ifconfig eth1 10.0.0.1
# echo 1 > /proc/sys/net/ipv4/ip_forward
# route
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  default         192.168.1.1     0.0.0.0         UG    304    0        0 eth0
  192.168.1.0     *               255.255.255.0   U     304    0        0 eth0
  10.0.0.0        *               255.0.0.0       U       0    0        0 eth1

On comp2:

# systemctl disable wicd # just for avoiding any conflicts
# ip route flush table main # the same
# ifconfig eth0 10.0.0.2
# route add default gw 10.0.0.1
# netstat -r
   Kernel IP routing table
   Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
   default         10.0.0.1        0.0.0.0         UG        0 0          0 eth0
   10.0.0.0        *               255.0.0.0       U         0 0          0 eth0

Communication comp1 <-> comp2 works. Communication comp1 <-> extrenal hosts works. Packets from comp2 outside 10.0.0.0 don't pass comp1. `echo 1 > /proc/sys/net/ipv4/ip_forward' and...? What did I forget about?

Last edited by quayasil (2013-05-13 16:06:22)

Offline

#2 2013-05-13 15:45:22

hotvic
Member
Registered: 2013-02-11
Posts: 109

Re: [SOLVED] simple routing - what have I forgotten??

forgotten configure NAT on iptables ?

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables-save > /etc/iptables/iptables.rules
# systemctl start iptables

https://wiki.archlinux.org/index.php/Internet_Share

Offline

#3 2013-05-13 15:48:38

quayasil
Member
Registered: 2008-11-09
Posts: 112

Re: [SOLVED] simple routing - what have I forgotten??

I don't want NAT. I need just simple routing (it's my private, isolated network).

Last edited by quayasil (2013-05-13 15:52:04)

Offline

#4 2013-05-13 15:50:07

quayasil
Member
Registered: 2008-11-09
Posts: 112

Re: [SOLVED] simple routing - what have I forgotten??

Oh Gee! Sorry for this stupid question! Of course: I didn't set up route for 10.0.0.0/8 on 192.168.1.1... Sorry!

Offline

#5 2013-05-13 15:52:58

hotvic
Member
Registered: 2013-02-11
Posts: 109

Re: [SOLVED] simple routing - what have I forgotten??

Ok, sorry.

I don't know why isn't working then...

I do same here and is working, only difference is that I use 'ip' not 'ifconfig'

Edit:

Now I've read your message that you forgotten specify subnet mask /8

Last edited by hotvic (2013-05-13 15:55:49)

Offline

#6 2013-05-13 16:05:50

quayasil
Member
Registered: 2008-11-09
Posts: 112

Re: [SOLVED] simple routing - what have I forgotten??

Not "forgotten specify subnet mask". I forgot to set up a route for the network 10.0.0.0 on the router with 192.168.1.1: comp2 sends to 10.0.0.1 (comp1), comp1 routes it to its default gw (192.168.1.1, let's call it comp0) but comp0 doesn't know how to route (return) packets back to 10.x.x.x . Something like `route add 10.0.0.0 gw 192.168.1.2' (the address of the eth0 of comp1) was missing on comp0.

Last edited by quayasil (2013-05-13 16:33:25)

Offline

Board footer

Powered by FluxBB