Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
route one ip to an interface
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1341

PostPosted: Fri Aug 02, 2013 9:59 pm    Post subject: route one ip to an interface Reply with quote

Greetings routing guru's I am messing around with configuring and upgrading some test routers via their web interface from my laptop (running Gentoo). I would like this to not disturb my working internet connection.
Is there a simple way to network from a test router running its own dhcp and a web interface on 192.168.1.1 (connected via eth0) to some unused ip address on my laptop without affecting my real internet connection wlan0?

Here is my working routing table:
Code:
route -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         dsldevice.att.n 0.0.0.0         UG    0      0        0 wlan0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
192.168.1.0     *               255.255.255.0   U     9      0        0 wlan0


I tried some point to point stuff
Code:
 ifconfig eth0 10.0.0.1 -pointopoint 192.168.1.1 up

and
Code:
ifconfig eth0 192.168.1.2 -pointopoint 192.168.1.1 up

But that buggers my default route:
Code:
route -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    0      0        0 wlan0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     9      0        0 wlan0


Now with wireless off and just the router:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
192.168.1.0     *               255.255.255.0   U     202    0        0 eth0


Code:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::baca:3aff:febf:a7fe  prefixlen 64  scopeid 0x20<link>
        ether b8:ca:3a:bf:a7:fe  txqueuelen 1000  (Ethernet)
        RX packets 5333  bytes 5063237 (4.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7998  bytes 749635 (732.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf7e00000-f7e20000 

I am trying setting one routers to the 10.0.0.1 network but I know there is a better way.
Thanks for your ideas in advance
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42576
Location: 56N 3W

PostPosted: Fri Aug 02, 2013 10:06 pm    Post subject: Reply with quote

turtles,

Having two interfaces in the same subnet usually ends in tears.

If you use another subnet for eth0, it should just work.
However, the default setups will give you two default routes.

Either delete the default route over eth0 or set up eth0 statically without a default route.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1341

PostPosted: Fri Aug 02, 2013 10:20 pm    Post subject: Reply with quote

Thanks Neddy
NeddySeagoon wrote:

... or set up eth0 statically without a default route.

Could you elaborate on that?
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42576
Location: 56N 3W

PostPosted: Fri Aug 02, 2013 10:49 pm    Post subject: Reply with quote

turtles,

At each end of the eth0 link, put something like
Code:
config_eth0="192.168.100.20/24 brd 192.168.100.255"
into /etc/conf.d/net
This sets up eth0 on the box to use 192.168.100.20 on the 192.168.100.0/24 subnet.
At the other end, choose a different IP in the 192.168.100.0/24 subnet.

If you must, you can test a dhcp server on the 192.168.100.0/24 subnet as it will not interfere with your 192.168.1.0/24 subnet on wlan0.

For a full static setup, you would also have
Code:
routes_eth0="default via 192.168.100.253"
to set up the default route.
This line is deliberately omitted as you don't want a default route on eth0.

The .253 is a strange IP address to have a router listening on. There is a long story behind it, involving migrating my router from a dedicated box to a virtual machine but needing to have both setups connected at the same time for testing. I needed to test the new setup while my family used the the old one.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum