Linux 网络适配,ping命令,更改自己的IP地址

Linux系统下不同于Windows系统。Windoes系统下ping命令默认只发送接受四次数据,而Linux默认不会终止,可以通过Ctrl+C进行强制终止。

第一步:确认自己的IP地址,只能更改最后一位,如图可以更改为198.168.1.xx

               且我的网卡名为:eth0

CLC@Embed_Learn:~$ ping 192.168.1.88
PING 192.168.1.88 (192.168.1.88) 56(84) bytes of data.
From 192.168.1.8 icmp_seq=1 Destination Host Unreachable
From 192.168.1.8 icmp_seq=2 Destination Host Unreachable
From 192.168.1.8 icmp_seq=3 Destination Host Unreachable
From 192.168.1.8 icmp_seq=4 Destination Host Unreachable
From 192.168.1.8 icmp_seq=5 Destination Host Unreachable
From 192.168.1.8 icmp_seq=6 Destination Host Unreachable
From 192.168.1.8 icmp_seq=7 Destination Host Unreachable
From 192.168.1.8 icmp_seq=8 Destination Host Unreachable
From 192.168.1.8 icmp_seq=9 Destination Host Unreachable
^C
--- 192.168.1.88 ping statistics ---
10 packets transmitted, 0 received, +9 errors, 100% packet loss, time 9033ms
pipe 4

第二步:确认所要更改的IP地址没有配置,直接ping 所要更改的IP地址

CLC@Embed_Learn:~$ 
CLC@Embed_Learn:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:4f:9a:8a  
          inet addr:192.168.1.8  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2408:8220:21e:4eb0:de5:cc6b:e1d0:d648/64 Scope:Global
          inet6 addr: fe80::20c:29ff:fe4f:9a8a/64 Scope:Link
          inet6 addr: 2408:8220:21e:4eb0:20c:29ff:fe4f:9a8a/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5737 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6433 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:838739 (838.7 KB)  TX bytes:753263 (753.2 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2303 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2303 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:196982 (196.9 KB)  TX bytes:196982 (196.9 KB)

第三步:配置自己想要的IP地址,命令如下 

CLC@Embed_Learn:~$ sudo ifconfig eth0 192.168.1.88
sudo: unable to resolve host Embed_Learn
[sudo] password for CLC: 

检验:

CLC@Embed_Learn:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:4f:9a:8a  
          inet addr:192.168.1.88  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2408:8220:21e:4eb0:de5:cc6b:e1d0:d648/64 Scope:Global
          inet6 addr: fe80::20c:29ff:fe4f:9a8a/64 Scope:Link
          inet6 addr: 2408:8220:21e:4eb0:20c:29ff:fe4f:9a8a/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5806 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6489 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:844198 (844.1 KB)  TX bytes:760332 (760.3 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2347 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2347 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:201043 (201.0 KB)  TX bytes:201043 (201.0 KB)

 IP地址已经变成我们想要的,配置成功。

文章内若有错误,敬请指出,互相交流,共同进步!

你可能感兴趣的:(LINUX笔记)