command line manual network setting

在命令列設定好網路。



$ ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
... ...
... ...

network interface: eth0
ip address: 140.112.222.64
mask: 255.255.255.0 (slash notation is /24)
boardcast: 140.112.222.255
getway (router): 140.112.222.32

Network Mask Slash Equivalent
255.0.0.0 /8
255.255.0.0 /16
255.255.255.0 /24
255.255.255.128 /25
255.255.255.192 /26
255.255.255.224 /27
255.255.255.240 /28
255.255.255.248 /29
255.255.255.252 /30
255.255.255.254 /31
255.255.255.255 /32
 
The table is from the website

do the following settings:

$ ip addr add 140.112.222.64/24 brd 140.112.222.255 dev eth0
$ ip route add default via 140.112.222.32

then, try to

$ ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=51 time=3.57 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=51 time=3.79 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=51 time=3.57 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 3.573/3.646/3.791/0.102 ms

should work.

$ ping google.com

if not work, add DNS by:

$ echo "nameserver 8.8.8.8" >> /etc/resolve.conf

perfect!



留言

這個網誌中的熱門文章

[Antergos] disable touchpad

[Editor] 入坑 Atom => Markdown 轉 PDF