Java教程

ubuntu 开启ip转发的方法

本文主要是介绍ubuntu 开启ip转发的方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

ubuntu 开启网关转发

修改文件 /etc/sysctl.conf

cat /etc/sysctl.conf

  1. 找到 net.ipv4.ip_forward=1 这一行,取消注释既可
nano /etc/sysctl.conf
##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################

  1. 保存生效
$ sysctl -p
这篇关于ubuntu 开启ip转发的方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!