每次启动 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

相关内容