https://maytalkhao.com/archives/826

以下步骤都是按照上面这篇文章来的,具体细节如下

一、使用Softether  VPN Server Manager软件添加本地网桥

本地网桥设置--选择要桥接的虚拟hub--要创建的类型--新tap设备名称--创建本地桥

二、输入命令:ifconfig tap_soft,如果可以看到tap_soft网卡信息,那么可以进行下一步,否则看看上面步骤是不是哪里出错了

Softether使用本地网桥

 

三、安装dnsmasq服务

1、yum list |grep dnsmasq    先查询下包名,我这里得出以下2个软件包

Softether使用本地网桥

2、知道包名后就可以安装了,yum -y install dnsmasq.x86_64   dnsmasq-utils.x86_64

3、安装完成后配置/etc/dnsmasq.conf,在其中加入以下内容,内容自己看着写

      ******切记dhcp-range=tap_soft,192.168.8.2,192.168.8.254,12h   这里的IP范围给大一些,亲自踩过坑

interface=tap_soft
dhcp-range=tap_soft,192.168.8.2,192.168.8.254,12h
dhcp-option=tap_soft,3,192.168.8.1
dhcp-option=option:dns-server,192.168.8.1
resolv-file=/etc/resolv.dnsmasq.conf
strict-order
listen-address=0.0.0.0,::

4、编辑/etc/resolv.dnsmasq.conf(如果没有则创建),其中加入(nameserver自己看着写就OK):

vi /etc/resolv.dnsmasq.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 223.5.5.5
nameserver 223.6.6.6
nameserver 114.114.114.114

四、配置softether服务

编辑/etc/init.d/vpnserver文件,如果没有则创建

#!/bin/sh

INFO
vpnserver
syslog
syslog
5
6
time
.
INFO
=/usr/vpnserver/vpnserver
vpnserver
192.168.8.1
 
0
in
)
start
LOCK
1
TAP_ADDR
;
)
stop
LOCK
;
)
stop
3
start
1
TAP_ADDR
;
)
1
esac
0
 
五、配置内核
编辑/etc/sysctl.conf,net.ipv4.ip_forward = 1,然后运行sysctl -p,同步保存配置
 
六、配置防火墙,防火墙配置很关键,如果配置不好客户端是连不上服务端的
在默认表的input和output链里添加67和53端口tcp和udp的策略
在NAT表里添加本地网桥和物理网卡之间的互通策略,策略如下:

-A POSTROUTING -s 192.168.8.0/24 -j SNAT --to-source 123.209.51.80

123.209.51.80就是你服务器的公网IP

-A POSTROUTING -s 192.168.8.0/24 -o eth1 -j MASQUERADE

 
七、启动VPNserver和dnsmasq服务,本地网桥就可以正常工作了
/etc/init.d/vpnserver start
systemctl enable dnsmasq
systemctl start dnsmasq
 
 

 

Softether使用本地网桥

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2021-11-19
  • 2021-12-02
  • 2022-12-23
  • 2021-11-15
  • 2021-09-29
  • 2021-08-05
猜你喜欢
  • 2021-04-16
  • 2021-11-29
  • 2022-02-12
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2021-12-28
相关资源
相似解决方案