1

Я установил Ubuntu VM с помощью vagrant. Когда я SSH в ВМ и пинг google.com, он работает нормально. В течение минуты, а потом я просто прекращаю получать пакеты.

Единственный способ восстановить подключение к Интернету - это vagrant halt vagrant up затем бродить, и цикл продолжается.

Вот мой бродячий файл:

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/xenial64"

    config.vm.provider :virtualbox do |vb|
        vb.customize ['modifyvm', :id,'--memory', '2048']
        vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    end
    config.ssh.forward_agent = true


    config.vm.network "forwarded_port", guest: 3333, host: 3333
    config.vm.network "forwarded_port", guest: 3334, host: 3334

    config.vm.network "public_network", ip: "172.20.0.0", bridge: "en1: Wi-Fi (AirPort)"

end

VirtualBox адаптер 1: NAT

Адаптер VirtualBox 2: Bridged Adapter (en0: Wi-Fi airport)

ifconfig на виртуальной машине:

enp0s3    Link encap:Ethernet  HWaddr 02:66:2d:c5:e5:fb  
      inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
      inet6 addr: fe80::66:2dff:fec5:e5fb/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:2356 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2600 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:853063 (853.0 KB)  TX bytes:345717 (345.7 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:04:0a:19  
      inet6 addr: fe80::a00:27ff:fe04:a19/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:7640 errors:0 dropped:5 overruns:0 frame:0
      TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:1015565 (1.0 MB)  TX bytes:9216 (9.2 KB)

lo        Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:1 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1 
      RX bytes:112 (112.0 B)  TX bytes:112 (112.0 B)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
      inet addr:10.8.0.2  P-t-P:10.8.0.1  Mask:255.255.255.255
      UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
      RX packets:93 errors:0 dropped:0 overruns:0 frame:0
      TX packets:111 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:100 
      RX bytes:54331 (54.3 KB)  TX bytes:13457 (13.4 KB)

veth0040ba6 Link encap:Ethernet  HWaddr 4e:ac:ae:ca:c8:a2  
      inet6 addr: fe80::4cac:aeff:feca:c8a2/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:17 errors:0 dropped:0 overruns:0 frame:0
      TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:1784 (1.7 KB)  TX bytes:8856 (8.8 KB)

veth68a2190 Link encap:Ethernet  HWaddr d2:3a:14:c4:0d:bc  
      inet6 addr: fe80::d03a:14ff:fec4:dbc/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 B)  TX bytes:830 (830.0 B)

veth921a901 Link encap:Ethernet  HWaddr 7a:63:d4:3c:3d:65  
      inet6 addr: fe80::7863:d4ff:fe3c:3d65/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 B)  TX bytes:830 (830.0 B)

vetha454914 Link encap:Ethernet  HWaddr 2e:e1:5e:a0:29:4c  
      inet6 addr: fe80::2ce1:5eff:fea0:294c/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 B)  TX bytes:1338 (1.3 KB)

ifconfig на хосте (Mac OSX)

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 78:4f:43:9c:c4:cb 
inet6 fe80::843:e8e4:7a01:5b62%en0 prefixlen 64 secured scopeid 0x7 
inet 10.136.107.254 netmask 0xfffff800 broadcast 10.136.111.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active

p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether 0a:4f:43:9c:c4:cb 
media: autoselect
status: inactive

awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
ether 22:c0:41:1c:7d:e3 
inet6 fe80::20c0:41ff:fe1c:7de3%awdl0 prefixlen 64 scopeid 0x9 
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether b6:00:21:71:2a:01 
media: autoselect <full-duplex>
status: inactive

en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether b6:00:21:71:2a:00 
media: autoselect <full-duplex>
status: inactive

en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether b6:00:21:71:2a:04 
media: autoselect <full-duplex>
status: inactive

en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether b6:00:21:71:2a:05 
media: autoselect <full-duplex>
status: inactive

en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether ac:de:48:00:11:22 
inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0xe 
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active

bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether b6:00:21:71:2a:00 
Configuration:
    id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
    maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
    root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
    ipfilter disabled flags 0x2
member: en1 flags=3<LEARNING,DISCOVER>
        ifmaxaddr 0 port 11 priority 0 path cost 0
member: en2 flags=3<LEARNING,DISCOVER>
        ifmaxaddr 0 port 12 priority 0 path cost 0
member: en3 flags=3<LEARNING,DISCOVER>
        ifmaxaddr 0 port 10 priority 0 path cost 0
member: en4 flags=3<LEARNING,DISCOVER>
        ifmaxaddr 0 port 13 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive

utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::3ffd:a34b:785a:f6da%utun0 prefixlen 64 scopeid 0x10 
nd6 options=201<PERFORMNUD,DAD>XHC2: flags=0<> mtu 0

vboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00 

vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:01 

vboxnet2: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:02 

Я хочу, чтобы моя виртуальная машина могла общаться с внешним миром, а внешний - с моим виртуальным компьютером.

Также мой компьютер имеет стабильный интернет!

0