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 Gym101502 J-取数博弈
还有J题,J题自己并不是,套的板子,大家写的都一样,因为大家都是套板子过的,贴一下代码,等学会了写一篇博客... J.Boxes Game 代码: 1 //J. Boxes Game-取数博弈-不会, ...
- 2013 ACM/ICPC 亚洲区 杭州站
题目链接 2013杭州区域赛 Problem A Problem B 这题我用的是SPFA+ mask dp 首先跑5次SPFA: 1次是求出每个起点和其他所有点的最短距离 4次是求出每个输入的点和 ...
- Linux终端颜色设置
http://blog.sina.com.cn/s/blog_65a8ab5d0101g6cf.html http://www.tuicool.com/articles/NRZfIj #PS1='${ ...
- 谈谈 ServletConfig 和 ServletContext
目录 一.ServletConfig 和 ServletContext 的概念 二.ServletConfig 和 SerlvetContext 代码表示 一.ServletConfig 和 Serv ...
- electron入门教程
1.atom/electron github: https://github.com/atom/electron 中文文档: https://github.com/atom/electron/tree ...
- Android自定义控件之自定义属性(二)
前言: 上篇介绍了自定义控件的基本要求以及绘制的基本原理,本篇文章主要介绍如何给自定义控件自定义一些属性.本篇文章将继续以上篇文章自定义圆形百分比为例进行讲解.有关原理知识请参考Android自定义控 ...
- Android--------------几个ADB经常使用命令
1. 显示当前执行的所有模拟器: adb devices 2. 安装应用程序: adb install -r 123.apk 3. 获取模拟器中的文件: adb pull &l ...
- django(一)--- 安装django
准备好虚拟环境:Python开发虚拟环境 安装前的准备 1. 下载django:django下载 本文使用的是django-1.5.9(不同版本号之间的差别还是比較大的.别搞错了) 2.准备djang ...
- UVA 610 - Street Directions(割边)
UVA 610 - Street Directions option=com_onlinejudge&Itemid=8&page=show_problem&category=5 ...
- 怎样创建.NET Web Service http://blog.csdn.net/xiaoxiaohai123/article/details/1546941
为什么需要Web Service 在通过internet网购买商品后,你可能对配送方式感到迷惑不解.经常的情况是因配送问题找配送公司而消耗你的大量时间,对于配送公司而言这也不是一项增值服务. 为了解决 ...