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. 如何围绕企业战略,建设BI驾驶舱?

    随着企业的逐步发展,人员的增加.业态的复杂不仅对管理也对信息化的要求越来越高,甚至需要从战略角度出发,进行从上至下的全面推行. 关于这个话题,某公司深有体会.面对这样的瓶颈,一方面从优化信息架构.调整 ...

  2. Dynamics CRM 之ADFS 使用 WID 和代理的联合服务器场

    为此部署拓扑 Active Directory 联合身份验证服务 (AD FS) 等同于联合服务器场与 Windows 内部数据库 (WID) 拓扑中,但它将代理服务器计算机添加到外围网络,以支持外部 ...

  3. 易企秀微场景2016最新完整版V10.5,小编亲测修复众多错误

    易企秀V10.5更新说明1.修复拨号英文错误2.修复转送场景问题3.修复设置场景密码乱码问题4.修复前台批量删除客户图片5.修复数据收集分页问题6.修复图片分类错乱问题7.修复音乐和特效冲突问题8.修 ...

  4. Laravel大型项目系列教程(五)之文章和标签管理

    一.前言 本节教程将大概完成文章和标签管理以及标签关联. 二.Let's go 1.文章管理 首先创建管理后台文章列表视图: $ php artisan generate:view admin.art ...

  5. xhtml、html与html5的区别

    一.基本概念: html:超文本标记语言 (Hyper Text Markup Language) xhtml:可扩展超文本标记语言,是一种置标语言,表现方式与超文本标记语言(HTML)类似,不过语法 ...

  6. JAVA并发编程J.U.C学习总结

    前言 学习了一段时间J.U.C,打算做个小结,个人感觉总结还是非常重要,要不然总感觉知识点零零散散的. 有错误也欢迎指正,大家共同进步: 另外,转载请注明链接,写篇文章不容易啊,http://www. ...

  7. linux shell字符串内置的常用操作(获取长度、查找、替换)

    在编写shell程序时,经常会涉及到字符串相关操作.有许多命令语句,如awk,sed都能够做字符串各种操作. 事实上shell内置一系列操作符号,能够达到相似效果,使用内部操作符会省略启动外部程序等时 ...

  8. 【Pyrosim案例】01:空气流动

    1 案例说明 Pyrosim是一款FDS前后处理软件.以一个非常简单的案例来描述Pyrosim的工作流程.本案例计算域中包含一个空气入口,一个环境出口. 案例主要演示以下内容: 创建Vents 增加切 ...

  9. 最实用的IT类网站及工具大集合

    1.聚合数据 大家在开发过程中,可能会用到各种各样的数据,想找一些接口来提供一些数据.比如天气预报查询,火车时刻表查询,彩票查询,身份证查询等等.有了这个接口,直接调用即可.各种各样的API接口满足你 ...

  10. Android APP 简单高效的禁用横竖屏切换

    默认情况下,Android APP的界面会随着手机方向的改变而改变,当手机处于竖屏状态,APP的界面也处于竖屏状态,而当手机处于横屏状态,APP也会自动切换到横屏状态.一般情况下APP的界面都是为竖屏 ...