linux router

Taking care of your Linux box.

linux router

Postby zaeemarshad » Sun Aug 03, 2003 12:11 am

I was wondering if we can assign one ethernet interface multiple ips from different subnets( i know i can do it) and then make this linux pc act as a router between the two networks. can this be done?? thanks for any help

regards
zaeem
zaeemarshad
Lieutenant Colonel
 
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Website: http://zaeem.no-ip.org
WLM: zarshadvirk@hotmail.com
Yahoo Messenger: negativecreep61@yahoo.com
AOL: zarshadvirk
Location: Islamabad

its easy but be carefull

Postby farhanksa » Sun Aug 03, 2003 12:30 am

u can assign 1 ethernet multiple ip's but wt u wana do from that 1 ethernet.
u need alteast 2 ethernet
command is
ifconfig eth0 192.168.0.1 255.255.255.0 up
ifconfig eth1 192.168.1.1 255.255.223.0 up

note that second ip have diff subnet mask it may be same bcz the network is different
not ur linux box will act as router btween diff networks..
have u ever tried to give a static route to any WAN ip? or used ospf in linux??
farhanksa
Subedar
 
Posts: 359
Joined: Sun Nov 03, 2002 6:40 am
ICQ: 116765501
WLM: farhan12@msn.com
Yahoo Messenger: commdsl@yahoo.com
Location: Lahore

www.linuxrouter.org

Postby farhanksa » Sun Aug 03, 2003 1:42 am

aoa
it will help u a lot
www.linuxrouter.org
farhanksa
Subedar
 
Posts: 359
Joined: Sun Nov 03, 2002 6:40 am
ICQ: 116765501
WLM: farhan12@msn.com
Yahoo Messenger: commdsl@yahoo.com
Location: Lahore

Re: its easy but be carefull

Postby lambda » Sun Aug 03, 2003 6:58 am

farhanksa wrote:u need alteast 2 ethernet


not needed. try this:

ifconfig eth0 inet <ip-on-subnet1> netnask <the-netmask>
ifconfig eth0:1 inet <ip-on-subnet2> netmask <the-netmask>
ifconfig eth0:2 inet <ip-on-subnet3> netmask <the-netmask>
...

echo 1 > /proc/sys/net/ipv4/ip_forward (or whatever that file's called).
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby zaeemarshad » Sun Aug 03, 2003 8:40 pm

Well i tried it earlier what you wrote in your last email. well actually what i did was something like this on my linux pc

ifconfig etho:0 192.168.0.1 netmask 255.255.255.0 up
ifconfig eth0:1 10.0.0.1 netmask 255.0.0.0 up

then i gave my windows machine an ip of 192.168.0.2 and gave it the gateway address of 10.0.0.1 and it could easily ping the linux router but it could not ping other machines on the 10.0.0.0 subnet. that's where i am confused. any help. i am thinking of using zebra instead of static routes. a bit too much for such a task but it will work. dynamic routing is always easy.....

regards
zaeem
zaeemarshad
Lieutenant Colonel
 
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Website: http://zaeem.no-ip.org
WLM: zarshadvirk@hotmail.com
Yahoo Messenger: negativecreep61@yahoo.com
AOL: zarshadvirk
Location: Islamabad

if u dont have 2 ehternet then how can u reoute

Postby farhanksa » Mon Aug 04, 2003 12:26 am

aoa

if u have 1 ether net then only way is that u have switch or hub on the way.
then ur single ehternet can listen to the broadcasts or unicasts.

pls also check can u ping other 10.0.0.? machnices from 10.0.0.1
also try to change the gateway for toher machines
farhanksa
Subedar
 
Posts: 359
Joined: Sun Nov 03, 2002 6:40 am
ICQ: 116765501
WLM: farhan12@msn.com
Yahoo Messenger: commdsl@yahoo.com
Location: Lahore

Postby fawad » Mon Aug 04, 2003 5:28 am

zaeemarshad,
Do you have a firewall enabled? If so, try removing that. Second, make sure the net.ipv4.conf.all.forwarding parameter is set to 1. I know that this does work because I used to do this when I couldn't afford a second NIC for my home machine :)
fawad
Site Admin
 
Posts: 918
Joined: Wed Aug 07, 2002 8:00 pm
ICQ: 17672437
Website: http://www.fawad.net
WLM: fawadhalim@hotmail.com
Yahoo Messenger: fawad2048
AOL: fawadhalim
Location: Addison, IL

Postby lambda » Sat Aug 09, 2003 10:45 am

zaeemarshad wrote:then i gave my windows machine an ip of 192.168.0.2 and gave it the gateway address of 10.0.0.1 and it could easily ping the linux router but it could not ping other machines on the 10.0.0.0 subnet.


you gave a machine on the 192.168.0.x network a 10.0.0.x ip for its gateway? that won't work. the gateway has to be on the same network. that's why it's called a "gateway" -- it provides a path to other networks.

that's where i am confused. any help. i am thinking of using zebra instead of static routes. a bit too much for such a task but it will work. dynamic routing is always easy.....


you want to use dynamic routes for two networks that are connected to the same router? that would be a very interesting exercise, if somewhat academic. however, solve the first problem before trying this. it's a lot easier to debug.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

communicate

Postby Babarq » Sun Aug 17, 2003 7:57 am

aoa
the IP Ranged 10.x.x.x will never be on the same Lan as 192.x.x.x ....

The Gate way would never communicate as Classes are Totally different
try to give windows an IP of something Like 10.0.0.x range

Hope it helps
Regards
BQ
Babarq
Lance Naik
 
Posts: 28
Joined: Fri Mar 07, 2003 12:30 pm

Postby zaeemarshad » Mon Aug 18, 2003 2:15 am

it seems like i didnt explain the scenario right. let me explain again. we have a 192.168.168.x network with about 20 pcs connected using a hub. what i did was that i assigned 10 pc(both linux and win boxes) to a 10.0.0.x network. now as these both are on different subnets we need a router to communicate between the two subnets. as we are on a hub i assigned one of the linux machines two ips on eth0. one was virtual i.e. it was 10.0.0.1 on eth0:0. so the settings for the linux router are

192.168.168.1 on eth0
10.0.0.1 on eth0:0

now i enabled ip forwarding but nothing seems to get through from one subnet to the other. i hope this explains the problem. also i added the two networks using the route command. any help????
zaeemarshad
Lieutenant Colonel
 
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Website: http://zaeem.no-ip.org
WLM: zarshadvirk@hotmail.com
Yahoo Messenger: negativecreep61@yahoo.com
AOL: zarshadvirk
Location: Islamabad

Re: communicate

Postby lambda » Tue Aug 19, 2003 4:53 pm

Babarq wrote:the IP Ranged 10.x.x.x will never be on the same Lan as 192.x.x.x ....


they can be on the same lan. they just won't be on the same subnet.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby zaeemarshad » Tue Aug 19, 2003 6:25 pm

:P
I know about the fact that you pointed out and this is why i posted this post so that i can get a router to communicate between the two subnets.

thanx
zaeemarshad
Lieutenant Colonel
 
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Website: http://zaeem.no-ip.org
WLM: zarshadvirk@hotmail.com
Yahoo Messenger: negativecreep61@yahoo.com
AOL: zarshadvirk
Location: Islamabad

Postby sakbar » Wed Aug 20, 2003 2:27 am

Correct me if iam wrong ..

what if linux machine can act as bridge in this situation !

--shakeel
sakbar
Naik
 
Posts: 88
Joined: Wed Aug 07, 2002 8:00 pm
Website: http://www.rootshell.be/~linuxpak
WLM: sakbar76
Yahoo Messenger: shakeel_akbar
Location: Lahore

Postby zaeemarshad » Wed Aug 20, 2003 10:10 pm

a bridge will pass on all packets between the two subnets and this will choke the network bandwidth which i simply dont want apart from security considerations and access controls.

cheers
zaeemarshad
Lieutenant Colonel
 
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Website: http://zaeem.no-ip.org
WLM: zarshadvirk@hotmail.com
Yahoo Messenger: negativecreep61@yahoo.com
AOL: zarshadvirk
Location: Islamabad

did u ever use

Postby farhanksa » Wed Aug 20, 2003 11:53 pm

aoa
did u ever use the subnet zero and subnet one with the linux box router..
and how many sub eth interface does linux supports??may be 256
farhanksa
Subedar
 
Posts: 359
Joined: Sun Nov 03, 2002 6:40 am
ICQ: 116765501
WLM: farhan12@msn.com
Yahoo Messenger: commdsl@yahoo.com
Location: Lahore


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron