FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CRUX > CRUX

 
 
LinkBack Thread Tools
 
Old 02-03-2011, 08:33 PM
Rick Thomas
 
Default How to configure CRUX as a router?

Hi!

What configuration things do I have to set up in order to use my crux
box as a router.


This is what I've got:


rbthomas@greybox:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:10:5A:26:F7:42
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::210:5aff:fe26:f742/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1864 errors:0 dropped:0 overruns:0 frame:0
TX packets:138 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:173767 (169.6 Kb) TX bytes:11140 (10.8 Kb)
Interrupt:53 Base address:0xe000

eth1 Link encap:Ethernet HWaddr 00:03:93:6F:AB:A0
inet addr:192.168.1.162 Bcast:192.168.1.255 Mask:
255.255.255.0
inet6 addr: 2001:4978:21a:1:203:93ff:fe6f:aba0/64
Scope:Global

inet6 addr: fe80::203:93ff:fe6f:aba0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3140 errors:0 dropped:0 overruns:0 frame:0
TX packets:2275 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:475513 (464.3 Kb) TX bytes:211541 (206.5 Kb)
Interrupt:41 Base address:0x5000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:438 (438.0 b) TX bytes:438 (438.0 b)



rbthomas@greybox:~$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window
irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0
0 0 eth1
10.0.0.0 0.0.0.0 255.0.0.0 U 0
0 0 eth0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0
0 0 eth1



rbthomas@greybox:~$ cat /etc/rc.d/net
#!/bin/sh
#
# /etc/rc.d/net: start/stop network
#

case $1 in
start)
# loopback
/sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
/sbin/ip link set lo up
# ethernet
## /sbin/dhcpcd -t 10 -h $HOSTNAME --noipv4ll eth1
/sbin/ip addr add 192.168.1.162/24 dev eth1 broadcast
192.168.1.255 scope global

/sbin/ip link set eth1 up
# ethernet
/sbin/ip addr add 10.0.0.1/8 dev eth0 broadcast 10.255.255.255
/sbin/ip link set eth0 up
/sbin/ip route add default via 192.168.1.254 dev eth1
echo 1 > /proc/sys/net/ipv4/ip_forward
;;
stop)
/usr/bin/killall -q /sbin/dhcpcd
/sbin/ip route del default
/sbin/ip link set eth0 down
/sbin/ip link set eth1 down
/sbin/ip link set lo down
/sbin/ip addr del 127.0.0.1/8 dev lo
/sbin/ip addr del 10.0.0.1/8 dev eth0
/sbin/ip addr del 192.168.1.162/24 dev eth1
/sbin/ip route del default
echo 0 > /proc/sys/net/ipv4/ip_forward
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 [start|stop|restart]"
;;
esac

# End of file




eth1 is connected to my main home network.
eth0 is connected via a crossover cable to a debian box.

I can't make the crux box route packets from the debian box to the
rest of the home network...



debian:~# ping -n 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.197 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.121 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.114 ms
64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.113 ms
^C
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.113/0.136/0.197/0.036 ms
debian:~# ping -n 192.168.1.162
PING 192.168.1.162 (192.168.1.162) 56(84) bytes of data.
64 bytes from 192.168.1.162: icmp_seq=1 ttl=64 time=0.213 ms
64 bytes from 192.168.1.162: icmp_seq=2 ttl=64 time=0.119 ms
64 bytes from 192.168.1.162: icmp_seq=3 ttl=64 time=0.146 ms
^C
--- 192.168.1.162 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.119/0.159/0.213/0.040 ms
debian:~# ping -n 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
^C
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4014ms

debian:~# traceroute -n 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 30 hops max, 40 byte
packets

1 10.0.0.1 0.212 ms 0.082 ms 0.078 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 *^C




The traceroute and the first and second ping show that packets are
getting from the debian box to the crux box OK. But the rest of the
traceroute shows that the crux box isn't forwarding beyond itself.


Anybody got any clues?

Thanks!

Rick

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 02-03-2011, 09:00 PM
Wawrzyniec Niewodniczański
 
Default How to configure CRUX as a router?

On 3 February 2011 21:33, Rick Thomas <rbthomas@pobox.com> wrote:
> Hi!
>
> What configuration things do I have to set up in order to use my crux box as
> a router.
>
How did you configured iptables?

Wawrzek

--
┬*Wawrzyniec Niewodnicza┼äski┬* ┬* ┬* vel Wawrzek Larry or LarryN
┬* ┬* Linux User #177124┬* ┬* ┬* ┬* ┬* ┬* ┬* E-MAIL: wawrzek@gmail.com
┬*PhD in Quantum Chemistry┬* ┬* ┬* ┬* ┬* ┬* WWW: http://wawrzek.name
┬*MSc in Molecular Engineering┬* ┬* ┬* ┬* ┬*┬* JID: wawrzek@jabber.wroc.pl
_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 02-03-2011, 09:25 PM
Moritz Wilhelmy
 
Default How to configure CRUX as a router?

Hi,

maybe try something along the lines of

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o <output-interface> -j MASQUERADE

Best regards,

Moritz
_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 

Thread Tools




All times are GMT. The time now is 11:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ę2007 - 2008, www.linux-archive.org