如何在每次啟動 WSL 2 時獲得相同的 IP?

如何在每次啟動 WSL 2 時獲得相同的 IP?

每次啟動 WSL 時,我都會在 eth0 上獲得一個新 IP,如何使 IP 靜態,以便每次在 eth0 上獲得相同的 IP?

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ********** brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether ********** brd ff:ff:ff:ff:ff:ff
    inet 172.XX.XX.XX/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 ********/64 scope link
       valid_lft forever preferred_lft forever
4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0

相關內容