Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ How to use the internal network IP forwarding to connect to the Internet on Linux     - Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)

- Ubuntu install Vendetta Online 14.04 (Linux)

- ADSL router to defend their own network security methods (Linux)

- Linux system started to learn: Teaches you install Fedora 22 on VirtualBox (Linux)

- High-performance open-source http accelerator Varnish introduce (Server)

- MyCAT easy entry (Database)

- Windows 7 hard disk to install Ubuntu 14.10 (Linux)

- Installation Mesos + Marathon + Zookeeper under CentOS 7 (Server)

- Using Maven to download Spring (Linux)

- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)

- Use scripts easily install the latest Linux kernel in Ubuntu (Linux)

- CentOS 6.5_x64 install Oracle 11g R2 (Database)

- ImportTsv-HBase data import tool (Database)

- Wireshark basic introduction and learning TCP three-way handshake (Linux)

- OpenCV cvFindCornerSubPix () to find sub-pixel Corner (Programming)

- Ubuntu 14.04.1 LTS compile and install the new kernel (Linux)

- Oracle multi-user concurrency and transaction processing (Database)

- C language binary tree (Programming)

- By way of a binary installation innobackupex (Database)

- Copy U disk files to the Linux system on a virtual machine (Linux)

 
         
  How to use the internal network IP forwarding to connect to the Internet on Linux
     
  Add Date : 2018-11-21      
         
         
         
  Hello everyone, today we learn on Linux with iptables implement from one network interface to another interface IP forwarding (packet forwarding). IP forwarding concept is to make Linux machine as a router to send data from one network to another network. Therefore, it can act as a router or a proxy server, to achieve a connection or network Internet connection sharing to multiple client machines.

This is some of the simple steps to enable IP forwarding or network packet forwarding method.

1. Enable IPv4 Forwarding

First, we need to enable IPv4 forwarding on our Linux operating system. To do this, we need to use sudo mode execute the following command in the shell or terminal.

$ Sudo -s
# Echo 1> / proc / sys / net / ipv4 / ip_forward
Temporary IP Forwarding

Note: The above command can now enable ip forwarding, but only temporarily, until the next reboot. To permanently enabled, we need to use our favorite text editor to open /etc/sysctl.conf file.

# Nano /etc/sysctl.conf
Then, increase net.ipv4.ip_forward = 1 to the file, or delete a comment that line, save the file and exit.

net.ipv4.ip_forward = 1

Run the following command to enable the change.

# Sysctl -p /etc/sysctl.conf

Configuring Iptables Firewall

We need to allow specific (or all) of the data packets through our router. Prior to this, we need to know the name of the interface connected to our network of Linux devices. We can run the following command in the terminal or shell to obtain the interface name.

# Ifconfig -a

Here, in our machine, eth2 is connected to the Internet or a network card interfaces, wlan2 we want to use iptables to forward packets from eth2 interface. To achieve forwarding, we need to run the following command.

# Iptables -A FORWARD -i wlan2 -o eth2 -j ACCEPT
Note: Please use your Linux machine available to replace the device name wlan2 and eth2.

Now, thanks to netfilter / iptables is a stateless firewall, we need to allow established connections iptables through. To do this, we want to run the following command.

# Iptables -A FORWARD -i eth2 -o wlan2 -m state --state ESTABLISHED, RELATED -j ACCEPT

3. Configure NAT

Then, finally we need to modify the source address of the packet sent to the Internet for eth2 by executing the following command.

# Iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE

to sum up

Finally, as we have in our iptables firewall on a Linux machine from a successful configuration of the interface to another data packet forwarding. This article will teach you your proprietary interface to connect to the Internet, without bridging interface, but the data packet routing from one interface to another interface comes in. It is that, if you have any questions, suggestions, feedback, please write to the following comment box, then we can improve or update our content.
     
         
         
         
  More:      
 
- Oracle metadata Reconstruction experiments (Database)
- Arduino UNO simulation development environment set up and run simulation (Linux)
- Ubuntu 14.04 next upgrade to GNOME 3.12 (Linux)
- crontab task scheduling Health Check (Linux)
- Let OpenCV face detection score output codes (Programming)
- Source code is installed MySQL 5.6.28 (Database)
- Linux redirection and piping (Linux)
- How to install Visual Studio Code on Ubuntu (Linux)
- Linux more command Detailed (Linux)
- CentOS7 installation configuration Redis-3.0.0 (Database)
- Spring WebSocket Comments (Programming)
- Element content of Java HashSet change issues (Programming)
- To install Ganglia (Linux)
- How to remove the files inside the privacy of data on Linux (Linux)
- How to configure Proftpd server on Fedora 22 (Server)
- Analysis JavaBean (Programming)
- GAMIT10.5 under CentOS installation (Linux)
- Linux check disk parameters trapping lack amendments (Linux)
- CentOS iptables firewall enabled (Linux)
- VMware virtual machine can not start VMnet0 no Internet access and other issues (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.