# [solved] eth0 : dhcp and eth2 : local

## Gregoire

Hello,

I have this in my /etc/conf.d/net :

```

modules_eth0="!plug"

modules_eth2="!plug"

mac_eth0="random-samekind"

modules_eth_eth0=( "dhclient" )

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 10"

dhcp_eth0="release nontp nonis"

```

I started "/etc/init.d/net.eth0 start" which show in messages :

```

Nov 23 19:00:08 vdr kernel: skge eth0: disabling interface

Nov 23 19:00:08 vdr kernel: skge eth0: enabling interface

Nov 23 19:00:08 vdr kernel: ADDRCONF(NETDEV_UP): eth0: link is not ready

Nov 23 19:00:08 vdr dhcpcd: version 5.1.3 starting

Nov 23 19:00:08 vdr dhcpcd: eth0: waiting for carrier

Nov 23 19:00:11 vdr kernel: skge eth0: Link is up at 1000 Mbps, full duplex, flow control both

Nov 23 19:00:11 vdr kernel: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Nov 23 19:00:11 vdr dhcpcd: eth0: carrier acquired

Nov 23 19:00:11 vdr dhcpcd: eth0: checking for 169.254.7.8

Nov 23 19:00:17 vdr dhcpcd: eth0: using IPv4LL address 169.254.7.8

Nov 23 19:00:17 vdr dhcpcd: forking to background

Nov 23 19:00:20 vdr dhcpcd: eth0: broadcasting for a lease

Nov 23 19:00:20 vdr dhcpcd: eth0: offered 77.56.xxx.yyy from 10.255.128.1

Nov 23 19:00:20 vdr dhcpcd: eth0: acknowledged 77.56.xxx.yyy from 10.255.128.1

Nov 23 19:00:20 vdr dhcpcd: eth0: checking for 77.56.xxx.yyy

Nov 23 19:00:21 vdr kernel: eth0: no IPv6 routers present

Nov 23 19:00:26 vdr dhcpcd: eth0: leased 77.56.xxx.yyy for 3600 seconds

```

Which works (even if it's dhcpcd even I asked for dhclient).

Now I got a router which is connected to the internet (with another IP) to which I would like to connect with eth2 (no idea why it's not eth1).

I know (very little) about lxc https://forums.gentoo.org/viewtopic-t-801428-highlight-.html which seems really nice but maybe a little hard for me...

Is there a simple way to have access through eth2 to only 192.168.7.??? ?

Maybe only with a little change to /etc/conf.d/net ?

I don't want my internet traffic to go through my (slow) router.

Thank you very much.

EDIT : add [solved] in the titleLast edited by Gregoire on Tue Nov 24, 2009 7:07 pm; edited 1 time in total

----------

## coRpTitan

So you  file should looks like: /etc/conf.d/net

```

modules_eth0="!plug"

modules_eth2="!plug"

mac_eth0="random-samekind"

modules_eth_eth0=( "dhclient" )

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 10"

dhcp_eth0="release nontp nonis" 

config_eth2=( "192.168.7.2 netmask 255.255.255.0 brd 192.168.7.255" )

```

Last line = you have static IP for eth2.

And you can add there:

routes=( "default via X.X.X.X" )

So all traffic which should be delivered to IP addresses outside subnets connected directly to your eth0 eth2 will be sent to X.X.X.X .

If you want to change eth2 -> eth1 you can do it at: /etc/udev/rules.d/70-persistent-net.rules

----------

## Gregoire

Thanks, I added the config_eth1 lign (after commenting the rename of eth1 to eth2 in /etc/udev/rules.d/70-persistent-net.rules) and it seems to work as I expect  :Smile: 

Thank you very much.

----------

## coRpTitan

You are welcome, please don't forget to edit topic name and add there [SOLVED]  :Smile: 

----------

