You are not logged in.

#1 2006-01-23 21:42:08

stevenk
Member
Registered: 2006-01-23
Posts: 19

route problems

hi guys,

im trying to make to lans routeable using arch,
eth0 is 149.153.8.1
eth1 is 149.153.9.1
i want to able to ping each lan from the other,

was trying to add routes but didnt work, also tried using iptables to forward packets, neither worked. maybe i was close to getting it right or maybe im way off but after 4 hours im askin for help!!

heres the iptables i tried:
http://bbs.archlinux.org/viewtopic.php? … =ipforward

heres the route add i tried:

ifconfig eth0 149.153.8.0
route add -net 149.153.8.0 netmask 255.255.255.0 gw 149.153.8.1 dev eth0

ifconfig eth0 149.153.9.0
route add -net 149.153.9.0 netmask 255.255.255.0 gw 149.153.9.1 dev eth1

Offline

#2 2006-01-23 22:31:46

demonus
Member
Registered: 2005-01-31
Posts: 62

Re: route problems

you can't assign network addresses to interfaces

ifconfig eth0 149.153.8.1 netmask 255.255.255.0 broadcast 149.153.8.255 up

moreover adding routes to networks in which you already have interfaces is pointless, it's done automagically, just make sure that you have ip forwarding

sysctl net.ipv4.ip_forward=1

default iptables policies are to forward, so if you have not changed anything routing should work, otherwise

iptables -t filter -A -s 149.153.8.0/24 -d 149.153.9.0/24 -j ACCEPT

and identical entry for the second network

Offline

#3 2006-01-24 11:30:40

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

sorry was very quick writing that last night, made a few typos on my ifconfig

ifconfig eth0 149.153.8.1 netmask 255.255.255.0 broadcast 149.153.8.255 up
ifconfig eth1 149.153.9.1 netmask 255.255.255.0 broadcast 149.153.9.255 up
interfaces are ok

sysctl net.ipv4.ip_forward=1
is set

iptables -F
to clear the iptables

iptables -A -s 149.153.8.0/24 -d 149.153.9.0/24 -j ACCEPT     
Bad argument `149.153.8.0/24'

it wont accept that network as a source??

Offline

#4 2006-01-24 11:46:15

demonus
Member
Registered: 2005-01-31
Posts: 62

Re: route problems

I missed the chain name

iptables -A FORWARD -s 149.153.8.0/24 -d 149.153.9.0/24 -j ACCEPT

Offline

#5 2006-01-24 12:13:30

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

that command worked, but still not able to ping from lan to lan

when my ip is 149.153.8.2, i can ping 149.153.9.1 on the arch machine, but thats it

iptables -F
iptables -A FORWARD -s 149.153.8.0/24 -d 149.153.9.0/24 -j ACCEPT
iptables -A FORWARD -s 149.153.9.0/24 -d 149.153.8.0/24 -j ACCEPT

i also tried:
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
i dont know if they make a difference or not.

how do i automatically set net.ipv4.ip_forward=1
/etc/sysctl.conf was empty, but i put "net.ipv4.ip_forward=1" in there anyhow, but does automatically set to 1

Offline

#6 2006-01-24 12:40:57

demonus
Member
Registered: 2005-01-31
Posts: 62

Re: route problems

make sure machines on lan, say 149.153.8.0 have a route to 149.153.9.0 set to 149.153.8.1, or make 149.153.8.1 a default gateway, the icmp echo may go through but there's no return path for icmp reply

Offline

#7 2006-01-24 12:49:45

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

should i have the default gateways for machines in :

machines in lan 149.153.8.0
route add default gw 149.153.8.1

for lan 149.153.9.0
route add default gw 149.153.9.1

???

Offline

#8 2006-01-24 12:51:19

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

ok trying that now

Offline

#9 2006-01-24 15:35:10

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

yup its working now!
cheers!

I have those rules saved in /etc/iptables/iptables.rules
and have iptables in the daemon array

iptables fails to start but the rules still work

Offline

#10 2006-01-24 15:40:42

stevenk
Member
Registered: 2006-01-23
Posts: 19

Re: route problems

wait got it now,
thanx for the help demonus!!!

Offline

Board footer

Powered by FluxBB