# route one ip to an interface

## turtles

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:

```
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 

```
 ifconfig eth0 10.0.0.1 -pointopoint 192.168.1.1 up
```

and 

```
ifconfig eth0 192.168.1.2 -pointopoint 192.168.1.1 up
```

But that buggers my default route:

```
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:

```
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

```

```
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

----------

## NeddySeagoon

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.

----------

## turtles

Thanks Neddy

 *NeddySeagoon wrote:*   

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

 

Could you elaborate on that?

----------

## NeddySeagoon

turtles,

At each end of the eth0 link, put something like 

```
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 

```
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.

----------

