Na minha máquina virtual eu tenho duas interfaces de rede (o modo bridge, eu preciso do modo bridge porque eu quero criar um servidor). Um deles é Ethernet ( eth0
) e o outro WiFi ( wlan0
) - No guest (CentOS) eles são representados como enp0s3
e enp0s8
.
Eu configuro IPs estáticos para eles, mas a conexão só funciona quando meu laptop está conectado a um cabo Ethernet. Quando eu removê-lo eo laptop muda para WiFi, eu recebo o problema, mesmo com a interface enp0s8
(que na configuração do VirtualBox é wlan0
)
Anfitrião: Ubuntu 14.04
Convidado: CentOS
Configurações de rede do VirtualBox:
* Adapter 1:
* Mode: Bridge
* eth0
* Network Card: Intel PRO/1000 MT Desktop (82540EM)
* MAC: 080027BAC610
* Adapter 2
* Mode: Bridge
* wlan0
* Network Card: Intel PRO/1000 MT Desktop (82540EM)
* MAC: 080027F97DAE
Eu executei os seguintes comandos:
[root@localhost network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:ba:c6:10 brd ff:ff:ff:ff:ff:ff
inet 192.168.15.10/24 brd 192.168.15.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::99a9:d4a6:23c4:df9d/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:f9:7d:ae brd ff:ff:ff:ff:ff:ff
inet 192.168.15.24/24 brd 192.168.15.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fef9:7dae/64 scope link
valid_lft forever preferred_lft forever
[root@localhost network-scripts]# tracepath 8.8.8.8
1?: [LOCALHOST] pmtu 1500
1: localhost.localdomain 3006.372ms !H
Resume: pmtu 1500
ifcfg-enp0s3
representa o primeiro adaptador ( eth0
)
[root@localhost network-scripts]# cat ifcfg-enp0s3
HWADDR=08:00:27:BA:C6:10
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.15.10
NETMASK=255.255.255.0
DEFROUTE=yes
PEERDNS=no
DNS1=8.8.8.8
DNS2=8.8.4.4
GATEWAY=192.168.15.1
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=no
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="enp0s3"
UUID=6136f542-2b00-3fbd-a076-b80757d67316
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
ifcfg-enp0s8
representa o segundo adaptador ( wlan0
).
DEVICE=enp0s8
BOOTPRO=static
ONBOOT=yes
HWADDR=08:00:27:F9:7D:AE
IPADDR=192.168.15.24
NETMASK=255.255.255.0
GATEWAY=192.168.15.1
Também temos o comando ip r
e o resultado de /etc/resolv.conf
[root@localhost network-scripts]# ip r
default via 192.168.15.1 dev enp0s3 proto static metric 100
default via 192.168.15.1 dev enp0s8 proto static metric 101
192.168.15.0/24 dev enp0s3 proto kernel scope link src 192.168.15.10 metric 100
192.168.15.0/24 dev enp0s8 proto kernel scope link src 192.168.15.24 metric 101
[root@localhost network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
Como posso fazer a conexão funcionar independentemente de um cabo Ethernet estar ou não conectado?