mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-02-12 01:59:36 +08:00
Created 网络不允许桥接的情况下,如何在虚拟机运行udp2raw (markdown)
parent
3ab3268a47
commit
bc042f6172
19
网络不允许桥接的情况下,如何在虚拟机运行udp2raw.md
Normal file
19
网络不允许桥接的情况下,如何在虚拟机运行udp2raw.md
Normal file
@ -0,0 +1,19 @@
|
||||
==Macos + Virtual Box==
|
||||
在mac上运行:
|
||||
```
|
||||
sudo su # 先切换到root账号
|
||||
sysctl -w net.inet.ip.forwarding=1
|
||||
sysctl -w net.inet.ip.fw.enable=1 ##这两条的命令是开启ip_forward
|
||||
|
||||
echo 'nat on en0 from 192.168.56.0/24 to any -> (en0)' >1.tmp.rule #新建一个文件, en0是的mac上网的网卡。 192.168.56.0/24是mac和虚拟机间hostonly网络的子网
|
||||
pfctl -d
|
||||
pfctl -F all
|
||||
pfctl -f 1.tmp.rule -e #以上4条命令是为了开启nat
|
||||
```
|
||||
|
||||
在虚拟机中运行:
|
||||
```
|
||||
ip route default via 192.168.56.1 dev eth0
|
||||
echo `nameserver 8.8.8.8`
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user