我正在使用 Arch Linux,
我有多个互联网连接:
一个是 wifi,另一个是 3G usb 调制解调器
首先我的 wifi 启动了,然后 3G 互联网启动了。网络管理器显示两者都已启动。但是 wifi 互联网正在使用中。现在我想使用 3G 调制解调器来做某事。
Question1: How to switch to 3G internet using some command line command.
以下是来自网络管理器的连接信息。
3G connection
IP address: 10.178.202.42
Broadcast Address: 10.179.255.255
Subnet Mask: 255.252.0.0
Primary DNS: 8.8.8.8
WIFI Connection:
IP address: 192.168.4.160
Broadcast Address: 192.168.7.255
Subnet Mask: 255.255.248.0
Primary DNS: 192.168.0.1
我知道 wifi 正在被使用,因为我读到第一个连接将是默认连接。Question2: But how to check which is default using some command,
该命令的输出如下:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 wwan0
10.176.0.0 0.0.0.0 255.252.0.0 U 7 0 0 wwan0
192.168.0.0 0.0.0.0 255.255.248.0 U 9 0 0 wlan0
Question3: I cant understand what this output means. What is the difference beyween gateway and DNS
还有 ip 输出:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
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: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:1d:ba:07:87:98 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:21:5d:e8:77:3a brd ff:ff:ff:ff:ff:ff
inet 192.168.4.160/21 brd 192.168.7.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::221:5dff:fee8:773a/64 scope link
valid_lft forever preferred_lft forever
4: wwan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 02:15:75:3d:29:27 brd ff:ff:ff:ff:ff:ff
inet 10.178.202.42/14 brd 10.179.255.255 scope global wwan0
valid_lft forever preferred_lft forever
inet6 fe80::15:75ff:fe3d:2927/64 scope link
valid_lft forever preferred_lft forever
我上面的输出是 inet 是什么:它显示一个“/”,例如在 wwan0 中:10.178.202.42/14。Question4: what does that 42/14 means.
答案1
route del default gw 192.168.4.160
route add default gw 10.178.202.42