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的更多相关文章

  1. 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 ...

  2. Postgres Basic Commands for Beginners

    Just sharing what I have learned about postgres recently. Here is a part of basic commands you may n ...

  3. 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 ...

  4. Network Basic Knowledge

    @1: 应用层的常用协议以及对应的端口号: DNS 53/tcp/udp SMTP 25/tcp POP3 110/tcp HTTP 80/tcp HTTPS 443/udp TELNET 23/tc ...

  5. linux basic commands

    1. man - an interface to the on-line reference manuals $man man 2. apt - advanced package tool SEE A ...

  6. kafka basic commands

    kafka-server-start.sh config/server.properties & kafka-server-stop.sh kafka-topics.sh    --creat ...

  7. Network Principle Course Summary 001

    1.物理层 物理层 协议:RJ45.CLOCK.IEEE802.3 (中继器,集线器) 作用:通过媒介传输比特,确定机械及电气规范(比特Bit) 1.1 通信基础 数据 (data) —— 运送消息的 ...

  8. 【转】linux network namespace 学习

    原文地址:https://segmentfault.com/a/1190000004059167 介绍 在专业的网络世界中,经常使用到Virtual Routing and Forwarding(VR ...

  9. 机器学习技法:14 Radial Basis Function Network

    Roadmap RBF Network Hypothesis RBF Network Learning k-Means Algorithm k-Means and RBF Network in Act ...

随机推荐

  1. UIScrollView的封装

    UIScrollView的封装 效果 特点 1.用法简单,尺寸大小,随意设置位置 2.可以有多个数据源的数据,可以定制不通的界面(如同上图,一个有文字,一个没有文字) 3.能够实现点击事件 用法 1. ...

  2. Linux2.6内核协议栈系列--TCP协议1.发送

    在介绍tcp发送函数之前得先介绍很关键的一个结构sk_buff,在linux中,sk_buff结构代表了一个报文: 然后见发送函数源码,这里不关注硬件支持的分散-聚集: /* sendmsg系统调用在 ...

  3. HotApp小程序统计,第一个专业的微信第三方小程序统计工具

    1.什么是HotApp小程序统计 HotApp小程序统计是第一个微信第三方小程序统计工具,就像做android 和 ios开发的人知道友盟统计一样,小程序也需要有个统计工具. 通过这个工具,可以知道小 ...

  4. iOS开发常用快捷键

    二. Xcode基本快捷键 新建项目 Shift + CMD + N 项目中新建文件 CMD + N 运行 CMD + R 编译 CMD + B 停止运行 CMD + . 清除缓存 Shift + C ...

  5. 初识JAVA(二)(送给Java和安卓初学者)----常见错误

    博主接着上篇的来讲哦,以后的更新中,博主会出一些练习题,有兴趣的可以做做然后吧代码粘贴到下面,大家可以一起研究学习,一起进步,本篇文章主要讲的是: 一.常见错误 二.连接上篇一起的训练 无论是什么方向 ...

  6. 【转】JavaScript常用代码书写规范

    javascript 代码规范 代码规范我们应该遵循古老的原则:“能做并不意味着应该做”. 全局命名空间污染 总是将代码包裹在一个立即的函数表达式里面,形成一个独立的模块. 不推荐 1 2 3 var ...

  7. 简历生成平台项目开发-STEP4第二次项目例会讨论

    时间:2016.7.15周五7点半 地点:图书馆 讨论主题:交流各自手头项目进展,确定下一步任务 内容:按照之前的讨论的任务大家各自汇报进度. 汇报人:谭卓.尹忠诚 内容:1.基于富文本编辑器的模板, ...

  8. MySQL备份原理详解

    备份是数据安全的最后一道防线,对于任何数据丢失的场景,备份虽然不一定能恢复百分之百的数据(取决于备份周期),但至少能将损失降到最低.衡量备份恢复有两个重要的指标:恢复点目标(RPO)和恢复时间目标(R ...

  9. 【Windows编程】系列第六篇:创建Toolbar与Statusbar

    上一篇我们学习了解了如何使用Windows GDI画图,该应用程序都是光光的静态窗口,我们使用Windows应用程序,但凡稍微复杂一点的程序都会有工具栏和状态栏,工具栏主要用于一些快捷功能按钮.比如典 ...

  10. JQuery中$.ajax()方法参数详解 及 async属性说明

    url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如put和 ...