LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-19-2008, 05:17 PM   #1
hvc123
Member
 
Registered: Jun 2004
Posts: 33

Rep: Reputation: 16
route ?


hi all
i have 1 nic in my linux machine and i want to use it as a router

i have created an alias eth0:1

my eth0 is 10.10.1.1 255.255.255.0 (i wanna use this as dhcp as well)
my eth0:1 is 192.168.1.102 255.255.255.0 (my crappy router is 192.168.1.1)
how do i forward all traffic from eth0 through eth0:1

im going to try this and if succsefull a squid with QoS

thanks all

Last edited by hvc123; 12-19-2008 at 05:18 PM.
 
Old 12-19-2008, 05:20 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You probably need to allow forwarding (echo "1" > /proc/sys/net/ipv4/ip_forward)

What's the output of "route"
 
Old 12-19-2008, 05:21 PM   #3
hvc123
Member
 
Registered: Jun 2004
Posts: 33

Original Poster
Rep: Reputation: 16
here is my route -n


Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0

and

route

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
10.10.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 100 0 0 eth0

Last edited by hvc123; 12-19-2008 at 05:22 PM.
 
Old 12-19-2008, 05:25 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
So if you send traffic through this box on 10.10.1.1, what happens?
 
Old 12-19-2008, 05:27 PM   #5
hvc123
Member
 
Registered: Jun 2004
Posts: 33

Original Poster
Rep: Reputation: 16
from my xp box if i setup ip on the same subnet with gw set to 10.10.1.1

i get nothing ndr
cant ping google by name or ip
i can ping 10.10.1.1

Last edited by hvc123; 12-19-2008 at 05:28 PM.
 
Old 12-19-2008, 08:06 PM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Did you set forwarding as per post #2?

I just ran a quick test and enabling forwarding plus adding the IP alias seems to work for me.

FYI - route from client
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 ath0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ath0
0.0.0.0         192.168.1.101   0.0.0.0         UG    0      0        0 ath0
route on "router"
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
ifconfig on "router"
Code:
eth0      Link encap:Ethernet  HWaddr  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr:  Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:27474 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22765 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:28848178 (27.5 MiB)  TX bytes:3683970 (3.5 MiB)
          Interrupt:217 Base address:0x2000 

eth0:1    Link encap:Ethernet  HWaddr 00:14:85:BD:B0:F0  
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:217 Base address:0x2000
cat /proc/sys/net/ipv4/ip_forward
Code:
1
Running wireshark on "router" confirms traffic passing through.

Last edited by billymayday; 12-19-2008 at 08:10 PM. Reason: Switching machines.
 
Old 12-19-2008, 08:46 PM   #7
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
How do you even wire a one-NIC router?
 
Old 12-20-2008, 03:48 AM   #8
hvc123
Member
 
Registered: Jun 2004
Posts: 33

Original Poster
Rep: Reputation: 16
ok ill start again..
i have 1 imac g4 (ubuntu server, dhcp, dns, web, email) this only has one nic.

this is connected to my crappy di-624 router, i also have a desktop box and a few lappys.

what i want to do is have all lan traffic pass through the di-624 to the linux machine and then filtered it on the linux box. i also want to use it as a squid with qos.

i have created eth0:1 on a totally different subnet. i want eth0 for dhcp and eth0:1 for external(internet facing)

so here is my interfaces..

# The primary network interface
auto eth0
iface eth0 inet static
address 10.10.1.1
netmask 255.255.255.0
auto eth0:1
iface eth0:1 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1

the 10. range is going to be the local subnet and the 192 range is the external to the router.

cat /proc/sys/net/ipv4/ip_forward = 1
but this changes back to 0 after reboot
here is my rotue on the linux machine
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
10.10.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 100 0 0 eth0

now if i turn my dhcp router on the dlink off and the dhcp on my nix machine on it servers ips fine.
from my xp machine on the nix dhcp range.
ping 10.10.1.1 reply (nix eth0)
ping 192.168.1.101 reply (nix eth0:1)
ping 192.168.1.1 fail (dlink router)

so i can basically talk to the local network but not to my dlink..
so i cant pass traffic from 10.10.1.1 through the 192.168.1.101 to the dlink 192.168.1.1 internet facing address

i dont have any firewall on my nix machine yet... i was going to add that after i got the eth0 and eth0:1 talking properly

Last edited by hvc123; 12-20-2008 at 05:05 AM.
 
Old 12-20-2008, 12:48 PM   #9
hvc123
Member
 
Registered: Jun 2004
Posts: 33

Original Poster
Rep: Reputation: 16
ipforward is 1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iproute2 (ip route), pppoe and default route lorddoskias Linux - Networking 0 05-09-2007 11:04 AM
Default route took 20s to display with 'route' command Akhran Linux - Newbie 3 11-04-2006 04:59 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
ADSL as a Alternate route or backup route bhagat2000 Linux - Networking 0 05-27-2004 03:17 PM
Working with 'route' and unwanted route entries pioniere Linux - Networking 6 02-05-2003 12:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration