標籤:預設 rac sysconf tcpdump echo images amp ice err
Network Basic Commands Summaryset or modify hostname
a) temporary ways
hostname NEW_HOSTNAME, but if you reboot your system, it will disabled.
b) permanent ways:
edit “/etc/sysconfig/network” HOSTNAME, then restart system, it will effect..
And you better to modify the “/etc/hosts” to make the hostname be same as “/etc/sysconfig/network”, otherwise some service will start with slowly or error.
The picture is flowing:
View Network configuration
if you want to view the network configuration, you can use the command:
“ifconfig”
[[email protected]_Linux ~]#
[[email protected]_Linux ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:83:42:DE
inet addr:192.168.98.131 Bcast:192.168.98.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe83:42de/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2253 errors:0 dropped:0 overruns:0 frame:0
TX packets:1357 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:195575 (190.9 KiB) TX bytes:190320 (185.8 KiB)
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:16436 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1308 (1.2 KiB) TX bytes:1308 (1.2 KiB)
you also can view the network config
the detail of newwork.
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 ==》這裡是eth0網卡裝置的預設設定檔
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0 ================》這裡是網卡名稱第一塊網卡為eth0,第二塊為eth1...
BOOTPROTO=static============》static為固定IP地址,非動態DHCP擷取
BROADCAST=10.0.0.255 =======》這裡是廣播位址,一般為網路地址的最後一個地址。
HWADDR=00:0C:29:0E:5F:63 ===》這裡mac地址,不同的機器不能重複,尤其是在刻隆虛擬機器或複製網卡配置時要注意。
IPADDR=10.0.0.161 ==========》這裡是IP地址
NETMASK=255.255.255.0=======》子網路遮罩/24
NETWORK=10.0.0.0 =========》網段設定
ONBOOT=yes =================》開機網卡自啟動
GATEWAY=10.0.0.254==========》網關的配置,也可以命令列通過route添加刪除。
TYPE=Ethernet===============》類型
提示:第一塊網卡為ifcfg-eth0,第二塊為ifcfg-eth1...
If you want to add another network settings.you use two ways flowing:
a) temporary ways
use thiscommand:” ifconfig eth0:1 10.0.0.0/24 ”
or “ifconfig eth0:1 10.0.0.0 netmask255.255.255.0”
if you restartthe network service ,it will be lost
if you want tomake it permanent, you should create a file whose content is same as “ifcfh-eth0”,but file name is the network name you want to create.
modify or set DNS
DNS will be write two main files.
The first file is “/etc/sysconfig/network-scripts/ifcfg-eth0”
The second file is “/etc/resolv.conf”. But thisfile is same as the above.
if edit the “/etc/resolv.conf” NAMESERVER, thenrestart the network service, the NAMSEVER
will be lost and the DNS1 in the “/etc/sysconfig/network-scripts/ifcfg-eth0”will be set in the “/etc/resolv.conf”. In a word, the “NAMESERVER” must keepsame with “DNS1
”
View route configuration
if want to view the route config ,you canuser the “route -n”.
the last line is default route.
you can also add new route or delete route.
add new route use this command
routeadd default gw 10.0.0.254
delete existing route
routedel default gw 10.0.0.254.
Some ways to check you service whether can be used.
a) ping
ping is mean send ICMP ECHO_REQUEST to network hosts
for example:
InWindows Operate System, you also use this command.
b) dig
dig means DNS lookup utility.
for example:
c) traceroute
traceroute means to print the route packets trace networkhost.
d) tcpdump
tcpdump means to dump traffic on network.
if you want to check some requests and your service reply,you can use this command.
for example:
First executing “tcpdump -n icmp -i eth0” in your LinuxSystem.
Executing “ ping 192.168.98.131” in Window Operate System DOS.
you will view those in Linux System
you can see the REQUEST and REPLY.
if a request is replied, this show you server is good.
if a request is not replied, show you server is error.
you can use this command to check you server whether error.
This is very useful commands!
How to check your server when it can’t go Internet
1) checking physical line whetherfluent.
2) checking your server IP,DNS androute
3) checking your server gateway
4) ping open internet IP
7)如果win32和linux伺服器無法串連網路,分別描述排查方法?
此題留給大家了。大家可以評論或單獨和我交流。
提示:基本檢查思路:
a.物理鏈路是否通暢
b.本機IP,路由,DNS的設定情況是否達標。
c.測試到網關或路由器的通暢情況。
d.測試ping公網ip的通常情況(平時要記幾個外部IP)
e.測試DNS的通暢,可以ping etiantian.org看是否出對應IP。
根據每級的結果來排查,如果是系統管理員,以上問題都檢查了後,還可以在網關路由伺服器上向上向下測試。
逐級排查。
Network Basic Commands Summary