Linux network settings (version 2) and linux Version 2
Linux network settings-Internet addressing Process
1. Comparison of TCP/IP and OSI Reference Models
|
TCP/IP |
OSI |
Physical Layer |
Nic |
Data Link Layer |
* |
MAC address |
Network Layer |
IP, ICMP, ARP |
Transport Layer |
TCP, UDP |
Session Layer |
* |
Client-server |
Presentation Layer |
* |
Data Encryption and Compression |
Application Layer |
SSH, Apache, and other practical applications |
2. Internet addressing Process
1) MAC address
Dc: 0e: a1: d5: 8a: b2 [hardware address: 48 bits, 6 bits, hexadecimal writing]
Vendor ID (first 24 bits): Nic ID (last 24 bits)
Appendix-Linux view: ifconfig eth0
View in Windows: ipconfig/all
2) IP Address
192.168.14.127 [IPv4: 32-bit, 4-segment, 10-digit writing]
[IPv6: 128-bit, Hex writing]
Extended-DOS "Denial of Service Attack" SYNFLOOD (request packets like floods, Yahoo is suspended, IPv6 improves the security of this issue)
3) TCP/UDP
TCP: reliable, three-way handshake (breakpoint re-transmission, timer) [two military problems] [point-to-point] Full Duplex
UDP: fast, such as QQ, audio/video sharing
4) FQHN-complete computer name [domain name]
Www.sdust.cn.
Host name [www]. Second-level domain [sdust]. top-level domain [. cn]. Root Domain 【.]
Domain name level service structure
[There are 13 groups of root domain servers worldwide]
4) ARP Address Resolution Protocol
ARP parsing process
Arp-a # view the ARP cache table
Arp-d [IP address] # Delete ARP records
Arp-s [IP address] [MAC address] # Add ARP Static Records [be added with caution and take effect permanently]
5) RARP Reverse Address Resolution Protocol # Know Your MAC address and ask your IP address
Appendix-If host A accesses the WebServer on port 80 of host B, the port on host A should be A high port randomly allocated over 1024.
6) Resolve the domain name to an IP address
A) Hosts resolution method [oldest]: Save the/etc/hosts file [saved in Windows]
Format: IP address host name/Domain Name alias
This file has been in use. For example, some anti-virus software will shield the IP address of an illegal website from 127.0.0.1.
B) NIS-Network Information System [developed by Sun]
# Centralized File Management
C) DNS-Domain Name System # domain Domain Name, domain
# The entire Internet is DNS-based domain name resolution, among which BIND is the most popular domain name resolution Software
Domain delegate management
Recursive query [not very fast]
Client ----> www.csdn.net
1. Local DNS server [cache (generalized cache )]
Therefore, if you access a website slowly, (1) the bandwidth of the optical cable may be insufficient. (2) If the DNS server does not cache the website, recursive resolution is required first. (3) The server performance is poor.
2. root domain.
→. Net
3. top-level domain. net
→ Csdn.net
→ Back to DNS Server
→ Return to the Client
Cache Mechanism
Generalized cache: If www.csdn.net has been located, the root domain will not be asked again during the next visit to www.263.net 【. ], but directly located.. net server. If this is the attempt to access java.263.net, the server of 263.net is located instead of accessing it again. net Server
Appendix: 1. a mac address can correspond to multiple IP addresses
Ifconfig eth0: 1 192.168.1.1 # Add a new virtual network card eth0: 1
2. One IP Address can correspond to multiple MAC addresses
For example, cluster technology performs round-robin load, and performs average load based on different MAC addresses.
On Linux, You can bind two NICs to one IP address for acceleration.
3. a domain name can correspond to multiple IP addresses
In Windows: nslookup domain name # You can view the IP address of the website
4. One IP Address can correspond to multiple domain names
How do I configure the network in Linux?
1. install and configure network devices
When installing linux, if you have a nic, the installer will prompt you to provide TCP/IP network configuration parameters, such as the local ip address, the default gateway ip address, and the DNS ip address. based on these configuration parameters, the installer automatically compiles the NIC (which must be supported first in linux) driver into the kernel. but we must understand the process of loading the NIC driver, so we will be very easy to operate when we change the NIC later and use multiple NICs. nic drivers are loaded into the kernel as modules. All Nic drivers supported by linux are stored in the directory/lib/modules/(linux Version)/net /, for example, the driver of the inter 82559 series 10/100 M Adaptive boot Nic is eepro100.o, and the driver of 3C509 ISA Nic of 3COM is 3C509. o, DLINK pci 10 NIC Driver is via-rhine.o, NE2000 compatible NIC Driver is ne2k-pci.o and ne. o. after learning about these basic drivers, we can modify the module configuration file to replace or add a nic.
1. Modify the/etc/conf. modules File
This configuration file is an important parameter file for Loading modules. Let's take a look at an example file.
#/Etc/conf. modules
Alias eth0 eepro100
Alias eth1 eepro100
This file is a conf file in a linux system with two inter 82559 series NICs. contents in modules. the alias command indicates the name of the driver of the Ethernet port (such as eth0). The alias eth0 eepro100 indicates that the driver to be loaded on the Ethernet port 0 is eepro100.o. when modprobe eth0 is used, the system automatically loads eepro100.o to the kernel. for pci NICs, because the system will automatically find the NIC's io address and interrupt number, there is no need. in modules, use options to specify the NIC's io address and interrupt number. but corresponding to the ISA Nic, it must be in conf. the io address or interrupt number specified in the module, as shown below, indicates the conf of an ISA Nic of NE. modules file.
Alias eth0 ne
Options ne io = 0x300 irq = 5
After modifying the conf. modules file, run the following command to load the module:
# Insmod/lib/modules/2.2.14/net/eepro100.o
In this way, you can load the module eepro100.o at the Ethernet port. You can also run the following command to view the information of the currently loaded module:
[Root @ ice/etc] # lsmod
Module Size Used
Eepro100 15652 2 (autoclean)
The returned result indicates that the currently loaded module is eepro100, with a size of 15652 bytes and two users. The returned result is cleared automatically.
2. Modify the/etc/lilo. conf file.
In some newer linux versions, because the operating system automatically detects all related hardware, you do not have to modify/etc/lilo. conf file. however, for the ISA Nic and old version, you can modify lilo to initialize the newly added Nic In system initialization. conf file. in/etc/lilo. in the conf file, add ...... remaining full text>
Linux network settings
First, set the virtual machine to bridge, and then configure the ip address
Ping the gateway 192.168.100.100 using a virtual machine.
Generally, a vro provides a dial-up function. If your real machine does not make a dial-up every time on the Internet, it is an automatic Dial-Up On The vro. Otherwise, you do not need to dial-up.
Linux ping 192.168.100.100 indicates that the IP address and gateway are correct.
Otherwise, the IP address or gateway settings are incorrect.
To solve the IP address and gateway problems, enter setup to enter the network. In general, only one network card is the one under eth0.
But remember, there is a use dhcp option in it, which indicates that you cannot manually set IP addresses when DHCP is enabled.
If you do not want to change it, you need to set up a DHCP server or enable the DHCP function of the route. to manually set it, you need to cancel this
After modifying the ip address, restart the NIC and enter ifdown eth0.
Ifup eth0
However, if the ping www.baidu.com fails, it indicates that no DNS or DNS is set incorrectly.
Vi/etc/resolv. conf
Input I
Enter
Nameserver's own city dns
Nameserver's own city dns
Example: I am in Chengdu
Nameserver 202.98.96.68
Nameserver 61.139.2.69
Enter the following information when exiting, and then press x to save it.
Ask again if you do not understand