#Vagrantで作成したサイトをスマホで確認する方法
##Vagrantファイルの編集
Vagrant
下記をコメントアウトから外す
config.vm.network "public_network"
##仮想環境の起動
vagrant up
そのあとに、こんなのを聞かれるのでWi-Fiを選ぶ
==> default: Available bridged network interfaces:
1) en0: Wi-Fi (AirPort)
2) en1: Thunderbolt 1
3) en2: Thunderbolt 2
4) bridge0
5) p2p0
6) awdl0
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
default: Which interface should the network bridge to? 1
##仮想環境にログイン
vagrant ssh
ifconfig
ifconfig
するとこんなのが出てくる
vagrant ssh
eth0 Link encap:Ethernet HWaddr 08:00:27:C9:39:9E
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fec9:399e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:569 errors:0 dropped:0 overruns:0 frame:0
TX packets:349 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:61343 (59.9 KiB) TX bytes:49460 (48.3 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:DB:43:3A
inet addr:192.168.33.10 Bcast:192.168.33.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fedb:433a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:800 (800.0 b) TX bytes:1945 (1.8 KiB)
eth2 Link encap:Ethernet HWaddr 08:00:27:35:77:36
inet addr:192.168.11.13 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe35:7736/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:53 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4731 (4.6 KiB) TX bytes:3227 (3.1 KiB)
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:16436 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:0
RX bytes:95 (95.0 b) TX bytes:95 (95.0 b)
##スマホでアクセス
ifconfig
で表示されたやつのinet addr
のIPをスマホでアクセスする
どれかにアクセスすれば表示される