Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何修改出口网关/网卡? #990

Closed
Ssssix40 opened this issue Jul 20, 2021 · 5 comments
Closed

如何修改出口网关/网卡? #990

Ssssix40 opened this issue Jul 20, 2021 · 5 comments

Comments

@Ssssix40
Copy link

您好,我的主网卡是eth0,然后有一个虚拟网卡wg0,我想把ipsec client的流量通过wg0出去
我有尝试过修改/etc/ipsec.conf文件中的left为wg0的ip地址,但是并不奏效,此时client也无法连接

@Ssssix40
Copy link
Author

这里是大概的一个拓扑图

目前我在ipsec client访问ifconfig.me能得到ipsec server的公网IP,我的目的是想要获得wireguard server的公网IP

@hwdsl2
Copy link
Owner

hwdsl2 commented Jul 21, 2021

@Ssssix40 你好!如果要指定出口网卡,你可以尝试编辑 /etc/sysctl.conf, /etc/iptables.rules/etc/iptables/rules.v4(如果存在)。将所有相关的 eth0 替换为 wg0。保存文件并重启服务器。应该不需要修改 /etc/ipsec.conf。需要修改的 VPN 相关的 IPTables 规则请参见脚本 [1] 中的包含 NET_IFACE 变量的行。

[1] https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/vpnsetup.sh

@AnonymousWebHacker
Copy link

@Ssssix40 你好!如果要指定出口网卡,你可以尝试编辑 /etc/sysctl.conf, /etc/iptables.rules/etc/iptables/rules.v4(如果存在)。将所有相关的 eth0 替换为 wg0。保存文件并重启服务器。应该不需要修改 /etc/ipsec.conf。需要修改的 VPN 相关的 IPTables 规则请参见脚本 [1] 中的包含 NET_IFACE 变量的行。

[1] https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/vpnsetup.sh

@Ssssix40 this work for you?

@Ssssix40
Copy link
Author

@Ssssix40 你好!如果要指定出口网卡,你可以尝试编辑 /etc/sysctl.conf, /etc/iptables.rules/etc/iptables/rules.v4(如果存在)。将所有相关的 eth0 替换为 wg0。保存文件并重启服务器。应该不需要修改 /etc/ipsec.conf。需要修改的 VPN 相关的 IPTables 规则请参见脚本 [1] 中的包含 NET_IFACE 变量的行。
[1] https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/vpnsetup.sh

@Ssssix40 this work for you?

Actually, I gave up.
I'm sorry.
But I think this will work.

@AnonymousWebHacker
Copy link

I already tried several things, and nothing works. Every time I activate the wg client, it encapsulates all the traffic, and I can't connect to the l2tp server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants