The host connects to the Internet through the wlp3s0 interface, how should I set it up?

The route in ubuntu is the kernel

IP 路由表
目标            网关            子网掩码        标志  跃点   引用  使用 接口
default         _gateway        0.0.0.0         UG    20600  0        0 wlp3s0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 enp1s0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-a7bb0e83acce
172.19.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-3e612a4f6e85
192.168.3.0     0.0.0.0         255.255.255.0   U     100    0        0 enp1s0
192.168.8.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0 

To allow your Ubuntu host to access the Internet through interface wlp3s0, you need to ensure that the default route points to this interface. In your routing table, you can see that the default route (default) already exists, and the gateway (gateway) is _gateway, which usually refers to the default gateway. However, the gateway's IP address is not displayed.

First, make sure your default gateway is configured correctly. You can view the details of the default gateway using the following command:

ip route show default

If the default gateway is not configured correctly, you will need to set it manually. Assuming your default gateway IP address is 192.168.8.1 (this is just an example, please replace it according to your actual network configuration), you can use the following command to set the default gateway:

sudo ip route add default via 192.168.8.1 dev wlp3s0

This will point the default route to the wlp3s0 interface and send traffic to 192.168.8.1 (your default gateway).

Next, you need to make sure your DNS is configured correctly to resolve domain names. You can edit the /etc/resolv.conf file to configure the DNS server. For example, you can add Google's DNS servers 8.8.8.8:

sudo nano /etc/resolv.conf

Add the following lines to the file:

nameserver 8.8.8.8

Save and close the file.

Finally, make sure that the wlp3s0 interface is enabled. You can check the interface status using the following command:

ip link show wlp3s0

If the interface is not enabled, you can enable it using the following command:

sudo ip link set wlp3s0 up

Now, your Ubuntu host should be able to access the Internet through the wlp3s0 interface. If you have other specific network configurations or needs, please adjust the configuration accordingly.

Guess you like

Origin blog.csdn.net/CCCrunner/article/details/132692635