If you have installed Linux, how can you access the Internet through Linux? Here we will explain how to use NAT to share Internet access on the Linux Server ADSL, so that you can easily use the Linux server to access the Internet. I hope you will learn how to use NAT to access the Internet on the Linux Server ADSL.
1. Nic configuration.
Two NICs, eth0 is a dial-up Nic, IP: 192.168.1.1 other addresses are also allowed), eth1 is an intranet Nic, IP: 192.168.0.1. The mask is 255.255.255.0. The lan network segment is 192.168.0.0.
Note: Neither network card can be configured with a gateway. Dial PPPOE) Nic does not need to be set
2. PPPoE software upgrade and Installation
1) download in http://www.roaringpenguin.com/pppoe/#download
2) install rp-pppoe. Run as root
Rpm-Uvh rp-pppoe-3.5-1.i386.rpm
3. Modify/etc/sysctl. conf
Replace
Net. ipv4.ip _ forward = 0
Change
Net. ipv4.ip _ forward = 1
4. Remove the ipchains module and select only the iptables method as follows:
1) setup
2) Select system service
3) Remove ipchains
4) Select iptables
5) restart the machine
5. PPPoE client Configuration
After installing the rp-pppoe-3.5-1.i386.rpm, you can configure the PPPoE client. The process is as follows.
#/Usr/sbin/adsl-setup
>;>;>; Enter your PPPoE user name: -- Enter the user name of the dial-up account.
>;>;>; Enter the Ethernet interface connected to the ADSL modem For Solaris, this is likely to be something like/dev/hme0.for Linux, it will be ethn, where n is a number. (default eth0): -- enter eth0
>;>;>; Enter the demand value (default no): -- Enter no
>;>;>; Enter the DNS information here: -- Enter 210.52.149.2 depending on the IP address of the local carrier's DNS server)
>;>;>; Please enter your PPPoE password: -- enter the Netcom User password
>;>;>; Choose a type of firewall (0-2): -- enter 0
>;>;>; Accept these settings and adjust configuration files (y/n )? -- Input y
6. Start the dial-up connection
/Usr/sbin/adsl-start
After successful connection, the screen displays Connected.
Now, this linux instance can be browsed online.
7. IP camouflage
To enable other machines in the LAN to share the Internet via a Linux server, at least the following command must be executed:
Iptables-t nat-a postrouting-o ppp0-j MASQUERADE
After that, you can access the Internet through Linux on a PC with the network segment 192.168.0.0 and the gateway is 192.168.0.1!
8. Auto Start
To enable automatic dialing on a Linux server, perform the following steps.
1) chkconfig -- add adsl
2) setup
3) Select system services
4) Select ADSL
5) OK to exit
6) Open/etc/rc. d/rc. local and add the following statement at the end of the file.
- echo "[OK]"
- echo "Drop ICMP form anywhere"
- echo 1 >; /proc/sys/net/ipv4/icmp_echo_ignore_all
- echo "[OK]"
- iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
Note: The first four sentences are used to Disable ICMP to prevent other users from pinging.
9. Now everything is OK. A simple dial-up is built. After restarting the machine, we found that all internet shared connections in linux are ready. In this way, you can access the Internet on the Linux server.
- Key Points of Linux cluster technology
- Another Linux server cluster software for LifeKeeper
- Linux server cluster technology
- Step 7: Protect Linux servers
- Introduction to ntop configuration in Linux