linux 网络设备,网卡配置 ,相关
网络设备,网卡配置:
Eth0是物理网卡:唯一mac地址,Bcast:广播地址,MAsk:子网掩码,
Lo:系统自带的回环的ip地址,可以做一些基本的测试应用,比如没有网卡就用127.0.0.1, root@ubuntu:/# ifconfig ens33 down (停掉某个网卡,重启操作系统可以起起来)
root@ubuntu:/# ifconfig ens33 up (启动某个网卡) root@ubuntu:/# ifconfig ens33 192.168.115.129 (修改ip地址,临时生效,配置文件才能永久生效)
root@ubuntu:/# ifconfig ens33 192.168.115.129 netmask 255.255.255.0 (修改子网掩码,临时生效,配置文件才能永久生效) root@ubuntu:~# hostname (root是账号,ubuntu是计算机名称)
ubuntu
root@ubuntu:~# hostname yaowenpc (修改主机名称,这只是临时修改,重启后就还原,永久修改要修改配置文件)
root@yaowenpc:/#
DNS:解析域名,计算机没配置dns地址是没法上网的,DNS地址都是由供应商提供的,要手动指定,中国电信中国联通都会提供自己的dns地址,无论怎么上网走的网络都是电信或者联通的,(流浪www.baidu.com需要dns才能到百度服务器)
root@yaowenpc:/etc# vim resolv.conf (查看dns配置文件)
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
nameserver 219.141.136.10 :电信的dns
nameserver 202.106.0.20 :联通的dns
~
root@yaowenpc:/etc# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110: icmp_seq=1 ttl=128 time=13.9 ms Curl工具(http工具):
root@yaowenpc:/etc# curl -v -L www.baidu.com
* Rebuilt URL to: www.baidu.com/
* Trying 163.177.151.109...
* Connected to www.baidu.com (163.177.151.109) port 80 (#0)
> GET / HTTP/1.1
> Host: www.baidu.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: bfe/1.0.8.18
< Date: Thu, 15 Feb 2018 07:08:53 GMT
< Content-Type: text/html
< Content-Length: 2381
< Last-Modified: Mon, 23 Jan 2017 13:27:57 GMT
< Connection: Keep-Alive
< ETag: "588604dd-94d"
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Pragma: no-cache
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
< Accept-Ranges: bytes
<
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hi
# curl http://www.baidu.com >> /yw/baidu.html

网络测试和测试工具:
排查网络信息:QQ无法登陆了,邮箱不能使用了,网页打不开了。
如果自己电脑打不开一个网站,比如:被强了,南北互联(南方使用的是联通,北方使用的电信,导致间断性不能访问)。 Ping是发送数据包到对方主机,
Ping 网关 (网关是一台能够上网的服务器,通过网关才能够上网),如果有数据包返回,表示电脑和网关是互通的,说明局域网是互通的。 有没有配置dns地址,计算机要上网,需要域名解析,cat /etc/resolv.conf
root@yaowenpc:/# nslookup (nslookup验证有没有配置dns地址,dns配置的对不对)
> www.baidu.com (nslookup是一个工具用来解析域名,输入www.baidu.com域名)
Server: 127.0.1.1 (server 127.0.1.1是主dns服务器去解析,有没有www.baidu.com这个域名,有的话就解析出来,没有就去别的dns服务器上查找)
Address: 127.0.1.1#53 (Address: 127.0.1.1#53,其他dns服务器从1到53上面去查找)
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
(百度的服务器的另2个名字和ip地址)
Name: www.a.shifen.com
Address: 163.177.151.109
Name: www.a.shifen.com
Address: 163.177.151.110 root@yaowenpc:/# nslookup www.baidu.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 163.177.151.110
Name: www.a.shifen.com
Address: 163.177.151.109 要能够上网:必须有一个ip地址可以跟网关通信,要有域名解析功能dns, cat /etc/resolv.conf。 Traceroute是跟踪路由,访问百度需要经过多少个设备。
root@yaowenpc:/# traceroute www.baidu.com
traceroute to www.baidu.com (163.177.151.110), 30 hops max, 60 byte packets
1 192.168.115.2 (192.168.115.2) 0.140 ms 0.056 ms 0.090 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * * root@yaowenpc:/# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.115.2 0.0.0.0 UG 0 0 0 ens33
link-local * 255.255.0.0 U 0 0 0 ens33
172.17.0.0 * 255.255.0.0 U 0 0 0 docker0
192.168.115.0 * 255.255.255.0 U 0 0 0 ens33
linux 网络设备,网卡配置 ,相关的更多相关文章
- SuSE Linux修改网卡配置
http://blog.chinaunix.net/uid-20765159-id-1850854.html SuSE Linux修改网卡配置 2010 SuSE linux ...
- 【Linux】网卡配置与绑定
Redhat Linux的网络配置,基本上是通过修改几个配置文件来实现的. 虽然也可以用ifconfig来设置IP,用route来配置默认网关,用hostname来配置主机名,但是重启后会丢失. 相关 ...
- Linux中网卡配置/etc/sysconfig/network-script/ifcfg-eth0
网络接口配置文件 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet #网卡类型 DEVIC ...
- linux双网卡配置
一.VM虚拟机添加一个网络适配器. 选择自己需要的模式类型 二.启动虚拟机,配置网卡 按原先配置网卡的方式配置完(ip地址及默认网关还有网卡名不能跟原先的一样) 重启所有网卡(service netw ...
- VM虚拟机安装 常用Linux命令 网卡配置 (第二天)
VM虚拟机安装:(昨天已经安装好了VM了,按照提示安装就好,很简单) 1.安装centos7虚拟机,现在磁盘里面新建文件夹作为安装文件夹 2.找到centos7的iso文件,打开vm-新建虚拟机-按照 ...
- linux常规网卡配置正确,但是出不了路由的解决方法
netstat -rn #查看是网关 route add default gw 192.168.128.2 dev eth0 # 手动加入网关地址 此类情况容易出现在双网卡配置后
- JAVA如何利用Swiger获取Linux系统电脑配置相关信息
最近开发java应用程序,涉及到获取Linux服务器相关配置的问题,特地网上搜寻了下,采用Swiger包可以直接获取,再次小结一下,以便于以后能方便使用,也便于其他童鞋们学习. 推荐大家参考链接:ht ...
- linux上单网卡配置使用多个IP地址
准备一台红帽系列的linux(例如rhel.red hat.centos.fredora等) 方法/步骤 新建配置文件. 首先说明一下规则: 新建配置文件,配置文件名称为ifcfg-适配器名称:0-2 ...
- linux 一个网卡配置多个IP
在Redhat系列(redhat,Fedora,Centos,Gentoo)中的实现方法如下: 1.单网卡绑定多IP在Redhat系列中的实现方法 假设需要绑定多IP的网卡是eth0,请在/etc/s ...
随机推荐
- Codeforces Gym101606 D.Deranging Hat (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))
D Deranging Hat 这个题简直了,本来想的是冒泡排序然后逆着输出来的,后来发现不对,因为题目上求的是最优解,而且冒泡的话,输出结果有的超出10000行了,所以就是把一开始的,排好序的字母标 ...
- 新华三孟丹:NFV资源池实现中的技术探讨
近日,在第三届未来网络发展大会SDN/NFV技术与应用创新分论坛上,新华三解决方案部架构师孟丹女士发表了主题为<NFV资源池实现中的技术探讨>的主题演讲. 孟丹指出,新华三的NFV核心理念 ...
- ML | PCA
what's xxx PCA principal components analysis is for dimensionality reduction. 主要是通过对协方差矩阵Covariance ...
- [Bzoj5359][Lydsy1805月赛]寻宝游戏(dp)
5359: [Lydsy1805月赛]寻宝游戏 Time Limit: 2 Sec Memory Limit: 512 MBSubmit: 71 Solved: 19[Submit][Status ...
- BZOJ1003物流運輸 DP + SPFA
@[DP, SPFA] Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要\(n\)天才能运完.货物运输过程中一般要转 停好几个码头.物流公司通常会设计一条固定的运 ...
- Java中泛型的Class<Object>与Class<?>的区别(转)
Object是一个具体的类名,而?是一个占位符号,表示任何类型,只要是SomeClass类或者子类就可以. List<Object>可以放任何类对象. List<? extends ...
- html中的列表标签
1.<dl>定义列表,<dt>定义列表中的项目,<dd>对项目的描述 例: 效果: 2.<ul>无序列表,<li>列表项 例: 效果: 3. ...
- 【转载】使用事件模型 & libev学习
参考这篇文章: http://www.ibm.com/developerworks/cn/linux/l-cn-edntwk/ 这里面使用的是 libev ,不是libevent Nodejs就是采用 ...
- linux mysql-server can't find mysql_config
linux mysql-server can't find mysql_config Ask Question up vote7down votefavorite 3 I have a running ...
- 百科知识 .tar.xz文件如何打开
7-ZIP可以打开,右击提取到当前目录即可 发现这个压缩比例还是相当不一般的,都快十倍了.