# gentoo & vmware dual nics in non-promiscuous mode [SOLVED]

## HeXiLeD

Everytime we use vmware after a standard install we will be using the box nic in promiscuous mode soon as we start vmware network.

My question is simple.

Can we use another existent different phisical nic to use it with vmware ?

In other words with regular use of vmware once we setup and start  the vmware network vmware will create a virtual nic that will use the box default phisical nic. Lets say eth0.

ie: vmware-virtual-nic ---> <linked> eth0 --> cable --> router -- > wan/lan

my box has 3 physical nics (eth0 eth1 eth2 )

gentoo uses eth0 with a cable that goes to the router and then 

gentoo --> eth0 --> router --> wan/lan

what i want is to make vmware  to use eth1 with a cable  that goes to the router and then wan/lan.

---------| GENTOO --> ETH0 --> CABLE --> ROUTER --> WAN/LAN 

BOX -- |

---------| VMWARE --> GENTOO -->  ETH1 --> ANOTHER CABLE --> ROUTER --> WAN/LAN

(eth0 and eth1 will have different ips)

im sure this can be done ...and im looking for some tips about it

----------

## HeXiLeD

ok so no replies yet... ehehe.

Lets divide things in 2 steps.

1: setup 2 nics in gentoo with 2 diferent ips

2: setup vmware  to use eth1

I belive  that the vmware parte is the easiest; so  for now i just need some tips to setup the different 2 nics .

I have created the respective init script for eth1 and even added another ip/setting in /etc/conf.d/net 

however it fails here: 

```
# /etc/init.d/net.eth1 start

 * Starting eth1

 *   Bringing up eth1

 *     <***.***.***.***>                     [ ok ]

 *   Adding routes

 *     default gw <***.***.***.***> ...  [ !! ]
```

It fails when looking for the gateway. ( i have specified the gateway="eth1/<ip>" ) in conf.d/net because  it seems unable to use the same ip/gateway that eth0 uses.

So i tested it by adding another ip there as if i had another router/gateway and it worked.

Unless i can work this around in with gentoo.... the other fast and possible way is to had another router to the network to be setup between  my box and the main router. ( this option does suck a bit )

and that would be like this: 

---------| GENTOO --> ETH0 --> CABLE --> MAIN-ROUTER --> WAN/LAN

BOX -- |

---------| VMWARE --> GENTOO --> ETH1 --> ANOTHER CABLE --> ROUTER2/WITH-DIFFERENT-GATEWAY --> MAIN-ROUTER --> WAN/LAN

For some reason both nics (eth0 & eth1) seem to fail to use the same gateway. . Is it suppose to be like this ?

----------

## Philantrop

 *Blue-Steel wrote:*   

> For some reason both nics (eth0 & eth1) seem to fail to use the same gateway. . Is it suppose to be like this ?

 

Depends. Please post both IPs of eth0 and eth1 and their netmasks.

----------

## HeXiLeD

/etc/conf.d/net

```
iface_eth0="192.168.1.2 broadcast 192.168.1.255 netmask 255.255.255.0"

gateway="eth0/192.168.1.1

iface_eth1="192.168.1.3 broadcast 192.168.1.255 netmask 255.255.255.0"

gateway="eth1/192.168.1.1

```

#ifconfig

```
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx

          inet addr:192.168.1.2 Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:4194287 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2334867 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:5310893902 (5064.8 Mb)  TX bytes:178946082 (170.6 Mb)

          Interrupt:177

eth1      Link encap:Ethernet  HWaddr  xx:xx:xx:xx:xx:xx

          inet addr:192.168.1.3 Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:185
```

# /etc/init.d/net.eth1 start

```
 * Starting eth1

 *   Bringing up eth1

 *     192.168.1.3                     [ ok ]

 *   Adding routes

 *     default gw 192.168.1.1 ..   [ !! ]
```

----------

## voytas

AFAIK you can't have two nics on the same logical network connected two different physical networks...

I suggest bring eth1 up but without any ip configuration, then bridge it with vmware nic (through vmware-config.pl), then in vmware you'll end up with only one interface which can be setup same as eth0 in gentoo (it won't be complaining)

This way you can use eth0 in gentoo and eth1 in vmware.

If you'd like to use eth1 in gentoo you could nat it in vmware...

----------

## HeXiLeD

currently i have it working flawlessly  :Smile: 

---------| GENTOO --> ETH0 --> CABLE --> ROUTER --> WAN/LAN 

BOX -- | 

---------| VMWARE --> GENTOO --> ETH1 --> ANOTHER CABLE --> ROUTER --> WAN/LAN

example of /etc/conf.d/net

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )

routes_eth0=( "default gw 192.168.0.1" )

config_eth1=( "192.168.0.3 netmask 255.255.255.0 brd 192.168.0.255" )

routes_eth1=( "default gw 192.168.0.1" )
```

this topic is solved.

----------

