- The derivation of the problem
The story is like this, has been using Ubuntu to learn the bird Brother Linux private dishes, and then there are many commands in Ubuntu is not preinstalled, you need to re-download the installation. On the other hand, although Ubuntu is doing very well, desktop environment is very delicate, many features can be achieved on the desktop with a few clicks on the mouse. But just because it's done so well, it's not appropriate to learn some of the basics of Linux, and people are always in trouble to learn to find and solve problems proactively. Then decisively moved to CentOS.
As a version of Red Hat, CentOS is really harder to use than Ubuntu, so it's easy to get started without Ubuntu. The lab's network connection device has WiFi and cable connection, the CentOS machine by the USB infinite network card and the wired network card, therefore thought can use this USB wireless card to realize the LAN connection. Although the use of Lsusb to view the USB device, the system can be recognized, but also a small excitement, and then eggs, this ya is looking good, even a half-day has not connected, back to the official website of the network card download Linux version of the drive also, the results installed a half-day or a variety of error, For me this rookie, want to at this stage of the level to solve these problems, I feel still forget.
so change a train of thought, change the cable, the network cable goes up, rinsed is done, also can on Xiaonei. Well, this problem comes, for Campus network environment, many people who have used Linux know that the Internet absolutely do not want to download a client like Windows double click on the finished, after all, is free of many applications support far from Windows rich. This is often let a lot of students deterred is the internet problem, before in Ubuntu Internet is also used in the laboratory of a great God compiled a Drcome source code to achieve the Internet, and in CentOS is not so easy, and the newly installed CentOS machine I think I still don't waste too much time on it , and did not try, perhaps really useful.
Now that the Ubuntu notebook on hand is able to surf the internet, using a wireless card, then the spare cable network card can be shared with the CentOS desktop network? So it began to Daoteng.
In order to explain this term specifically on the Internet to check a lot of information, and finally more looking at the more things, completely confused. In fact, the principle is very simple (I think blindly, wrong people as a joke):
Through IP forwarding to achieve network resource sharing, first two computers need to be in the same LAN, one computer A also has two network card, one of which is responsible for the external connection and the other one is and another computer B on the network card to build a small LAN. When a is connected to the network, b wants to download the movie via a, it needs a to send the request of B through the IP address of a, sending the packet outward, so that the center of gravity of the school will think it is a in the Internet movie. Wait until the website after the movie data transmission and received by a will judge that this is not the data I want, will be in their own LAN broadcasting (this is the function we set), and then B received the data, the purpose of verifying the IP is their own, that is, this is the data they want to receive over.
Here on the specific things, if the reader can not calm down to honestly see some information learning how to toss, said also useless.
1. Use a wired connection ab two computers, set the IP address to build a small network, PS: Do not forget the gateway to be consistent;
2. A computer IP forwarding settings, the specific command can refer to:
A. View/proc/sys/net/ipv4/ip_forward, if 1 is set, otherwise set to 1;
B. iptables-f
C. iptables-a Forward-j ACCEPT
D. iptables-t nat-a Postrouting-j Masquerade
The appeal order can be viewed by man, not in detail here.
3. Finally a to achieve the external network connection, B can go through a internet.
Solve a problem, you will find more problems, and then when you solve these problems, your life will be more beautiful and convenient.
The more afraid of trouble, the more trouble!
20150804 Ubuntu IP forwarding for network sharing