Network Basic Commands Summary
Network Basic Commands Summary
set 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”
[root@YGH_Linux ~]#
[root@YGH_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.
[root@oldboy ~]# 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 this
command:” ifconfig eth0:1 10.0.0.0/24 ”
or “ifconfig eth0:1 10.0.0.0 netmask
255.255.255.0”
if you restart
the network service ,it will be lost
if you want to
make 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 this
file is same as the above.
if edit the “/etc/resolv.conf” NAMESERVER, then
restart 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 keep
same with “DNS1

”
View route configuration
if want to view the route config ,you can
user the “route -n”.
the last line is default route.

you can also add new route or delete route.
add new route use this command
route
add default gw 10.0.0.254
delete existing route
route
del 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:

In
Windows 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 network
host.

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 Linux
System.

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 whether
fluent.
2)
checking your server IP,DNS and
route
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的更多相关文章
- Linux--Introduction and Basic commands(Part one)
Welcome to Linux world! Introduction and Basic commands--Part one J.C 2018.3.11 Chapter 1 What Is Li ...
- Postgres Basic Commands for Beginners
Just sharing what I have learned about postgres recently. Here is a part of basic commands you may n ...
- CheeseZH: Octave basic commands
1.Basic Operations 5+6 3-2 5*8 1/2 2^6 1 == 2 %false ans = 0 1 ~= 2 %true ans = 1 1 && 0 %AN ...
- Network Basic Knowledge
@1: 应用层的常用协议以及对应的端口号: DNS 53/tcp/udp SMTP 25/tcp POP3 110/tcp HTTP 80/tcp HTTPS 443/udp TELNET 23/tc ...
- linux basic commands
1. man - an interface to the on-line reference manuals $man man 2. apt - advanced package tool SEE A ...
- kafka basic commands
kafka-server-start.sh config/server.properties & kafka-server-stop.sh kafka-topics.sh --creat ...
- Network Principle Course Summary 001
1.物理层 物理层 协议:RJ45.CLOCK.IEEE802.3 (中继器,集线器) 作用:通过媒介传输比特,确定机械及电气规范(比特Bit) 1.1 通信基础 数据 (data) —— 运送消息的 ...
- 【转】linux network namespace 学习
原文地址:https://segmentfault.com/a/1190000004059167 介绍 在专业的网络世界中,经常使用到Virtual Routing and Forwarding(VR ...
- 机器学习技法:14 Radial Basis Function Network
Roadmap RBF Network Hypothesis RBF Network Learning k-Means Algorithm k-Means and RBF Network in Act ...
随机推荐
- 一步步实现ABAP后台导入EXCEL到数据库【2】
前文:http://www.cnblogs.com/hhelibeb/p/5912330.html 既然后台作业只能在应用服务器运行,那么,我们可以先将要上传的数据保存在应用服务器中,之后再以后台作业 ...
- safari 浏览器window.history.go(-1)运行无效解决办法
这几天做了几个手机端app的wap页面,做完之后发现一个问题,那就是ios系统下的safari浏览器不支持window.history.go(-1)..无语... 解决方法很简单!加上return f ...
- UIView上的控件使用push方法跳转
有时候在项目中,为了保持前后页面的推进方式跳转方式一致,会在通过UIview上的控件跳到另一个Controller上,所以,这时候就需要用到这种方式了,当然,present方法可以实现跳转但是样式可能 ...
- 安卓DJ113舞曲网应用客户端 项目源码(服务器+客户端)
Android DJ113舞曲网app客户端 播放器源码 项目源码(服务器+客户端),这个项目整体有点类似天天动听的效果,非常漂亮的,支持第三方登录等功能,非常完整的一个音乐项目. 源码下载:htt ...
- [Erlang 0110] Erlang Abstract Format , Part 1
Erlang Abstract Format并不难懂,只是枯燥一点罢了,如果把Abstract Format的文档翻译出来,其实就是Erlang教科书中语法入门的部分. Erlang Abstract ...
- javascript - 状态模式 - 简化分支判断流程
状态模式笔记 当一个对象的内部状态发生改变时,会导致行为的改变,这像是改变了对象 状态模式既是解决程序中臃肿的分支判断语句问题,将每个分支转化为一种状态独立出来,方便每种状态的管理又不至于每次 ...
- redis数据结构存储Dict设计细节(redis的设计与实现笔记)
说到redis的Dict(字典),虽说算法上跟市面上一般的Dict实现没有什么区别,但是redis的Dict有2个特殊的地方那就是它的rehash(重新散列)和它的字典节点单向链表. 以下是dict用 ...
- 0037 Java学习笔记-多线程-同步代码块、同步方法、同步锁
什么是同步 在上一篇0036 Java学习笔记-多线程-创建线程的三种方式示例代码中,实现Runnable创建多条线程,输出中的结果中会有错误,比如一张票卖了两次,有的票没卖的情况,因为线程对象被多条 ...
- 基于corosync+pacemaker+drbd+LNMP做web服务器的高可用集群
实验系统:CentOS 6.6_x86_64 实验前提: 1)提前准备好编译环境,防火墙和selinux都关闭: 2)本配置共有两个测试节点,分别coro1和coro2,对应的IP地址分别为192.1 ...
- [django]django 在apache2上部署静态文件如何加载
首先找到apache2的conf文件下的httpd.conf,添加如下信息: Alias /static/ E:/wamp/Apache24/www/static/ <Directory E:/ ...