linux--niaoge-service-04

Source: Internet
Author: User
Tags get ip nameserver dmesg

Operating system version: CentOS 6.10 x86_64

View network card information obtained by the kernel

[Email protected] ~]# DMESG |grep-inchETH1775: e10000000: Geneva:01.0: eth0: (Pci:66mhz: +-bit)xx: 0c: in: 6b:6e:1b1776: e10000000: Geneva:01.0: Eth0:intel (R) Pro/ +Network Connection1804: E1000:eth0 NIC Link is up +Mbps full Duplex, Flow control:none1807: Eth0:no IPv6 Routers present1820: Contact your hardware vendor to determine whether MoreRecent[[email protected]~]# Lspci |grep-I Ethernet Geneva:01.0Ethernet Controller:intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev on#上述信息显示第1775, 1776 cards using the module e1000, the use of the chip is Intel's network card, the speed can reach 1000Mbps full duplex mode (1804th). In addition to using DMESG,LSPCI can also be used to query chip data information. [[Email protected]~]# Lspci |grep-I Ethernet Geneva:01.0Ethernet Controller:intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev on) #因为是在虚拟机中运行的系统, so the data read is Intel's network card information. 

Observing the NIC module

[Email protected] ~]#Lsmod|grep  +e1000134799  0    //The description module is already loaded into the kernel.[[Email protected] ~]# modinfo e1000filename:/lib/modules/2.6. +-696. el6.x86_64/kernel/drivers/net/e1000/e1000.koversion:7.3. +-k8-NAPIlicense:GPLdescription:Intel (R) PRO/ +Network Driverauthor:intel Corporation,<[email protected]>SRCVERSION:A911791C4EFC2A93BCFCF6AALIAS:PCI:V00008086D00002E6ESV*sd*b .....  Omit ... depends:vermagic:2.6. +-696. el6.x86_64 SMP Mod_unload//kernel version modversionsParm:TxDescriptors:Number of transmit descriptors (array ofint) ..... parm:copybreak:Maximum size of packet that's copied to a new buffer on receive (UINT) Parm:debug:Debug level (0=none,..., -=all) (int)

Compiling the NIC driver

#下载网卡驱动源码: https://downloadcenter.intel.com///need to manually search under[Email protected] ~]#wgetHttps//nchc.dl.sourceforge.net/project/e1000/e1000e%20stable/3.4.2.1/e1000e-3.4.2.1.tar.gz#解压编译安装 [[email protected]~]#Tar-XF e1000e-3.4.2.1.Tar. gz-c/usr/local/src/#完成之后, then [[Email Protected]eji~]# Rmmod e1000//Delete on module#加载新模块 [[email protected]~]#modprobeE1000[[email protected]~]# Modinfo e1000# Set the startup Word Oh top you a start NIC module [email protected]~]# vim/etc/modprobe. d/ether.conf//new This filealias eth0 e1000alias eth1 e1000## #保存退出 [[email protected]~]#Sync[[Email protected]~]# reboot# configuration ip[[email protected]~]#ifconfigEth0192.168.30.130#不过这里建议: General Linux has a default NIC driver do not have to compile and install the driver, because once the kernel is updated, also manually compile the installation again. 

Network-related configuration files under Linux

Network parameters Primary Profile Name Important parameters

Ip

Netmask

Dhcp

Gateway, etc.

/etc/sysconfig/network-scripts/ifcfg-eth0

Device= NIC Name

bootproto= whether to use DHCP

Hwaddr= whether to join the NIC MAC address

Ipaddr=ip Address

netmask= Subnet Mask

onboot= boot is enabled by default

gateway= Gateway Address

nm_controlled= Additional network management software (NetworkManager), it is recommended to cancel this project

Host Name /etc/sysconfig/network

Networking= whether to use the network

Whether networking_ipv6= supports IPV6

Hostname= Host Name

DNS IP /etc/resolv.conf Name Server DNS IP Address
Host name corresponding to the private IP /etc/hosts Host name corresponding to the private IP

In addition to the above-mentioned documents, there are

/etc/services This file is a document built on TCP/IP above the various protocols, including HTTP, FTP, SSH, telnet and other services defined by the port number, is the file is planned, if you need to define a new protocol corresponding to the port, You can modify this file.

/etc/protocols This file defines the data about the IP packet protocol, including the definition of the ICMP/TCP/UDP packet protocol, and so on.

You can use Ifup and ifdown to turn on and off network card commands

Network card configuration file/etc/sysconfig/network-scripts/ifcfg-eth0 detailed

[Email protected] ~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0//device name, must correspond with Ifcfg-eth0Type=ethernet//Network Typeuuid=df2276d3-82d4-4e2b-9695-B587ae061759onboot=yes//enabled by defaultNm_controlled=yes//whether it is managed by third-party software, it is recommended to set noBootproto=dhcp//get IP mode with values of only DHCP and none twoHwaddr=xx: 0C: in: 6b:6e:1b//MAC address, if a network card, you can ignore thisDefroute=Yes Peerdns=yespeerroutes=Yesipv4_failure_fatal=Yesipv6init=NoNAME="System eth0" //NIC name#静态IP的话, the following configuration is also available ipaddr=192.168.30.130  //IP Addressnetmask=255.255.255.0 //Sub-Networkgateway=192.168.30.2 //Gatewaynetwork=192.168.30.0 //the first IP of the network segment can be omittedbroadcast=192.168.30.255 //broadcast address, can be omittedmtu= the //Maximum transmission light cloud setting value, if not changed, can be omittedNote that variables must all be capitalized

Definition and view of DNS IP

[Email protected] ~]# vim/etc/resolv.conf//Add the following two linesNameServer223.5.5.5nameserver119.29.29.29[[Email protected]~]# dig www.baidu.com; <<>> DiG9.8.2rc1-redhat-9.8.2-0.68. rc1.el6_10.1<<>>www.baidu.com; global options:+cmd;; Got answer:;; ->>header<<-Opcode:query, Status:noerror,ID:43587;; Flags:qr Rd RA; QUERY:1, ANSWER:3, authority:0, ADDITIONAL:0;;            QUESTION section:;www.baidu.com. in A;;        ANSWER SECTION:www.baidu.com. 5In CNAME www.a.shifen.com.www.a.shifen.com. 5In A115.239.211.112 //Baidu's server IPWww.a.shifen.com.5In A115.239.210.27;; Query Time:7msec;; SERVER:192.168.30.2# -(192.168.30.2)//The address here is the IP address of the defined DNS;; When:thu Sep6  -: the: A 2018;; MSG SIZE RCVD: -

Modification and viewing of host names

[Email protected] ~]# vim/etc/sysconfig/Network[[email protected]~]#Cat/etc/sysconfig/networknetworking=Yeshostname=Www.xueji.com[[email protected]~]# vim/etc/hosts127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4::1localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.30.12Www.xueji.com//Add this line[[Email protected]~]#Ping-C2Www.xueji.comPING www.xueji.com (192.168.30.12) About( -) bytes of data. -Bytes from www.xueji.com (192.168.30.12): icmp_seq=1Ttl= -  Time=0.021Ms -Bytes from www.xueji.com (192.168.30.12): icmp_seq=2Ttl= -  Time=0.028Ms---www.xueji.comPingStatistics---2Packets Transmitted,2Received0% packet loss, Time999msrtt min/avg/max/mdev =0.021/0.024/0.028/0.006Ms

Dial-up Internet (ADSL) (requires installation [[email protected] ~]# Yum install-y rp-pppoe)

Then use the commands provided by Pppoe-setup to set them up, and the process is no longer enumerated.

The settings for the wireless card are no longer listed here.

Approximate process:

1. Check the wireless card device

[Email protected] ~]# LSUSB
[[email protected] ~]# LSPCI //view NIC model

2. View the module and the corresponding network card code

[Email protected] ~~]# iwconfig
If you are using a USB wireless card, unplug it from the host, and then install the driver:
This is a bit of trouble, it is best to FQ, convenient (anyway, I did not find the right at home) This demo can not be temporary.

3. Using the Iwlist detection (wireless card) AP

4. Set the NIC configuration file vim/etc/sysconfig/network-scripts/ifcfg-xxx

5. Start the wireless network card XXX (XXX stands for the wireless card name)

linux--niaoge-service-04

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.