Configure Linux As a Router
来源:互联网 发布:amada折弯机编程教程 编辑:程序博客网 时间:2024/05/22 01:57
How to setup linux as router
You need two network interfaces in system (One can be pppoe).
1. Setup system gateway
Edit /etc/sysconfig/network, add gateway or gateway device such as below.
GATEWAY=192.168.0.1
or
GATEWAYDEV=ppp0
2. Turn on IP packet forwarding.
Edit /etc/sysctl.conf, modify below line.
net.ipv4.ip_forward = 1
3. Setup iptable (Only if your LAN IP is private IP and will forward to public IP)
The following examples assume that you are masquerading all computers on your private LAN 10.0.0 (i.e. 10.0.0.1, 10.0.0.2, etc.) and routing packets from that LAN to the Internet over your dial-up (ppp0) interface.
For iptables, type the following as root user:
# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# iptables -A FORWARD -s 10.0.0.0/24 -j ACCEPT
# iptables -A FORWARD -d 10.0.0.0/24 -j ACCEPT
# iptables -A FORWARD -s ! 10.0.0.0/24 -j DROP
# cp /etc/sysconfig/iptables /etc/sysconfig/iptables.old
# iptables-save > /etc/sysconfig/iptables
# /etc/init.d/network restart
# /etc/init.d/iptables restart
# iptables -L -n
Refer: http://etutorials.org/Linux+systems/red+hat+linux+bible+fedora+enterprise+edition/Part+IV+Red+Hat+Linux+Network+and+Server+Setup/Chapter+16+Connecting+to+the+Internet/Setting+up+Red+Hat+Linux+as+a+Router/
- Configure Linux As a Router
- 4.4. Operating as a Router
- How-to-configure-emacs-as-a-Python-IDE
- iptables filter with a linux router
- configure modem on cisco router
- Firewalld Rich and Direct Rules: Setting up RHEL 7 Server as a Router
- Ubuntu 11.04 as Wifi Router
- How To Configure BIND as a Private Network DNS Server on Ubuntu 14.04
- How to install JBoss AS 7 as a Linux service
- Fortigate to cisco router ipsec vpn configure!
- Starting Tomcat as a Service on Linux
- Starting Tomcat as a Service on Linux
- LINUX configure
- linux configure
- linux configure
- Linux ./configure
- how to write a configure script in linux
- as a
- PHPMailer中文说明
- Objective-C 属性特性(assign , retain , copy , readonly , readwrite , atomic , nonatomic)
- Dynamically add/remove elements via JavaScript
- 开始技术博客之旅
- GScript 全面更新到V6
- Configure Linux As a Router
- 一步一步:Ubuntu安装WordPress之安装WordPress
- poj 2250 最长公共子序列
- VirgoTomcat
- 几个简单的linux下操作的命令
- 怎样解决Mysql中文乱码问题
- Spring Scope
- vc6如何设置Unicode字符集
- pythonchallenge--3