$dhclientethN
Of course, you can also consider using static configuration.
ip_addressIt's localhost
IPaddress,
gw_ip_addressIt is the gateway to the network.
IPaddress.
$ ifconfig eth0 ip_address on$ route add deafult gw gw_ip_address
If the above doesn't work, remember to pass
ifconfig/mii-tool/ethtoolWait for the tool to check whether the network card is driven, and then pass
lspci/dmesgWait to check the network card type (or check the motherboard manual and the manual that comes with the independent network card), then install or compile the relevant driver, and finally pass the driver
insmod/modprobeWait for the tools to be loaded into the kernel.
The bridge works in
OSIThe second layer of the model, the data link layer, only needs to know the target host’s
MACThe address will work. The Linux kernel is in
2.2This function has been supported since the beginning. Please refer to the subsequent reference materials for specific configuration instructions. If you want to configure the Linux host as a network bridge, you need at least two network cards.
The function of a network bridge is equivalent to a network cable. Users do not need to care about what is inside. By connecting its two network ports to two hosts, the two hosts can communicate with each other. However, it is more powerful than a network cable. If it is equipped with a firewall, it can isolate the network segments connected to both ends of it (note that this is a network, because it does not recognize
IP), in addition, if the bridge has multiple network ports, a switch with complex functions can be implemented, and if multiple bridges are effectively combined, it is possible to implement a complex firewall system that can achieve flow control and load balancing.
Routing works in
OSIThe third layer of the model, the network layer, passes
routerLinux routing can be configured. Of course, there are many tools under Linux that support dynamic routing. Relevant information is overwhelming on the Internet. Due to time constraints, I will not introduce it here.
What network services are needed?
Get one for the LAN
DHCPServer, then get one
dhcpd, look at the references;
If you want to get an email sending server, then install it
sendmailor
exim4;
If you want to get a mailing list server again, then install one
mailman;
If you want to get a server that receives mail, then install one
pop3server;
If you want to get one
website, then get one
apacheor
nginxserver;
If you want to get the firewall service, then use
iptablesTool configuration
netfilterThat's it
What's more? If you can think of it, there is basically a corresponding implementation on Linux.
If a network problem occurs, don’t panic. Check each layer of the network step by step: physical link, link layer, network layer, and application layer. Be familiar with using various tools, including
ethereal/tcpdump,
hping,
nmap,
netstat,
netpipe,
netperf,
vnstat,
ntopwait.
For detailed usage of these tools and related knowledge on network problem diagnosis and maintenance, please see the subsequent related information.
If you want to do network programming development, for example:
To implement a client
/For server architecture applications, you can use Linux
socketprogrammed;
If you want to write a program for packet capture and protocol analysis, you can use
libpapetc. function library;
If you want to implement a certain protocol, you can refer to the relevant
RFCdocumentation and pass
socketProgramming to achieve.
You can refer to the relevant
Linux socketProgramming and other information.
It originally introduced some basic content related to the network, but due to time constraints, it was not elaborated. For more details, please refer to relevant materials.
At this point, the entire "Shell Programming Paradigm" has been roughly completed, but the "Example" lacks examples, especially in this section. Therefore, if time permits, some examples will be added gradually.
Computer Networks—A Top-Down Analysis Approach
Linux Network Architecture (Published by Tsinghua University Press)
Linux System Troubleshooting and Troubleshooting Chapter 13 Network Problems (People's Posts and Telecommunications Press)
Dial-up Internet access using ADSL under Linux
Collection of relevant information on wireless networks under Linux
Implementation analysis and use of Linux bridge
DHCP mini howto
The best 75 security tools
What network administrators must know
Two tools for detecting rootkits on Linux: Rootkit Hunter and Chkrootkit
Simple analysis of packet capture and ip protocol (based on pcap library)
RFC
C language programming implementation example of HTTP protocol