linux router
-
- Lieutenant Colonel
- Posts: 660
- Joined: Sat Jul 06, 2002 12:35 pm
- Location: Islamabad
- Contact:
linux router
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
regards
zaeem
its easy but be carefull
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??
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??
Re: its easy but be carefull
not needed. try this:farhanksa wrote: u need alteast 2 ethernet
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).
-
- Lieutenant Colonel
- Posts: 660
- Joined: Sat Jul 06, 2002 12:35 pm
- Location: Islamabad
- Contact:
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
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
if u dont have 2 ehternet then how can u reoute
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
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
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.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 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.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.....
communicate
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
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
BQ
-
- Lieutenant Colonel
- Posts: 660
- Joined: Sat Jul 06, 2002 12:35 pm
- Location: Islamabad
- Contact:
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????
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????
Re: communicate
they can be on the same lan. they just won't be on the same subnet.Babarq wrote:the IP Ranged 10.x.x.x will never be on the same Lan as 192.x.x.x ....
-
- Lieutenant Colonel
- Posts: 660
- Joined: Sat Jul 06, 2002 12:35 pm
- Location: Islamabad
- Contact:
-
- Lieutenant Colonel
- Posts: 660
- Joined: Sat Jul 06, 2002 12:35 pm
- Location: Islamabad
- Contact:
did u ever use
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
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