基础网络操作命令
ifup
作用:啟動網絡接口,直接在/etc/sysconfig/network-scripts下搜索對應的配置文件
用法:ifup interface
例如:
[root@lb ~]# ifup eth0
ifdown
作用:關閉網絡接口,直接在/etc/sysconfig/network-scripts下搜索對應的配置文件
用法:ifdown interface
例如:
[root@lb ~]# ifdown eth0
ifconfig
作用:查看或配置網絡接口信息
用法:ifconfig <interface>
例如:
[root@lb ~]# ifconfig eth0????##查看網絡接口信息
eth0????? Link encap:Ethernet? HWaddr 00:0C:29:D9:E0:37 ?
????????? inet addr:192.168.1.128? Bcast:192.168.1.255? Mask:255.255.255.0
????????? inet6 addr: fe80::20c:29ff:fed9:e037/64 Scope:Link
????????? UP BROADCAST RUNNING MULTICAST? MTU:1500? Metric:1
????????? RX packets:431 errors:0 dropped:0 overruns:0 frame:0
????????? TX packets:327 errors:0 dropped:0 overruns:0 carrier:0
????????? collisions:0 txqueuelen:1000
????????? RX bytes:53230 (51.9 KiB)? TX bytes:53540 (52.2 KiB)
[root@lb ~]# ifconfig eth0 192.168.1.128 netmask 255.255.255.0????##臨時配置網絡接口信息,重啟會失效
ip addr
作用:查看所有網絡接口信息
例如:
[root@lb ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
??? link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
??? inet 127.0.0.1/8 scope host lo
??? inet6 ::1/128 scope host
?????? valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
??? link/ether 00:0c:29:d9:e0:37 brd ff:ff:ff:ff:ff:ff
??? inet 192.168.1.128/24 brd 192.168.1.255 scope global eth0
??? inet6 fe80::20c:29ff:fed9:e037/64 scope link
?????? valid_lft forever preferred_lft forever
ping
作用:檢查物理鏈路的連通性
用法:ping serverip
例如:
[root@lb ~]# ping 192.168.1.128????##表示通
PING 192.168.1.128 (192.168.1.128) 56(84) bytes of data.
64 bytes from 192.168.1.128: icmp_seq=1 ttl=64 time=0.038 ms
64 bytes from 192.168.1.128: icmp_seq=2 ttl=64 time=0.035 ms
64 bytes from 192.168.1.128: icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from 192.168.1.128: icmp_seq=4 ttl=64 time=0.034 ms
[root@lb ~]# ping 192.168.1.129????##表示不通
PING 192.168.1.129 (192.168.1.129) 56(84) bytes of data.
From 192.168.1.128 icmp_seq=1 Destination Host Unreachable
From 192.168.1.128 icmp_seq=2 Destination Host Unreachable
From 192.168.1.128 icmp_seq=3 Destination Host Unreachable
From 192.168.1.128 icmp_seq=5 Destination Host Unreachable
telnet
作用:遠程登錄到網絡中的計算機或測試端口是否正常開啟
用法:telnet serverip <port>
例如:
[root@lb ~]# telnet 192.168.1.128 51898????##Connected表示通
Trying 192.168.1.128...
Connected to 192.168.1.128.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
[root@lb ~]# telnet 192.168.1.129 51898????##No route to host表示不通
Trying 192.168.1.129...
telnet: connect to address 192.168.1.129: No route to host
ssh
作用:遠程登錄網絡中的計算機
用法:ssh username@serverip -p port
例如:
[root@lb ~]# ssh linbin@192.168.1.128 -p 51898
The authenticity of host '[192.168.1.128]:51898 ([192.168.1.128]:51898)' can't be established.
RSA key fingerprint is 23:69:bd:25:1e:61:00:28:b7:86:b5:1e:71:1f:11:1b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.128]:51898' (RSA) to the list of known hosts.
linbin@192.168.1.128's password:
Last login: Wed Nov 25 09:03:28 2015 from 192.168.1.1
[linbin@lb ~]$
轉載于:https://blog.51cto.com/dongshi/1716285
總結
- 上一篇: [转]Windows的批处理脚本
- 下一篇: 解决删除从表,主表存在外键的问题