- 主题:如何指定某app对外通信的网络接口
比如我有
eth0 10.0.0.0
eth1 10.0.1.0
都通向公网
app监听在0.0.0.0:8080上,eth0和eth1都可以提供服务
但是我想把app对外发起的所有请求都走eth1,请问这个如何操作?
--
FROM 192.99.6.*
路由表里面,只给那个网卡设置网关?
【 在 wisedd (逍遥自在) 的大作中提到: 】
: 比如我有
: eth0 10.0.0.0
: eth1 10.0.1.0
: ...................
--
FROM 183.237.146.*
你这app不是监听状态等待外面连接吗?还会主动向外发起连接?
【 在 wisedd (逍遥自在) 的大作中提到: 】
: 比如我有
: eth0 10.0.0.0
: eth1 10.0.1.0
: ...................
--
FROM 111.199.187.*
你需要规划一下网络拓扑
【 在 wisedd (逍遥自在) 的大作中提到: 】
: 比如我有
: eth0 10.0.0.0
: eth1 10.0.1.0
: ...................
--
FROM 122.225.220.*
不要监听0.0.0.0
改为特定ip,例如eth1
【 在 wisedd 的大作中提到: 】
: 比如我有
: eth0 10.0.0.0
: eth1 10.0.1.0
: ...................
--来自微水木3.5.11
--
FROM 114.254.9.*
是app的对外发起,跟监听没关系的吧
【 在 zhangkung 的大作中提到: 】
: 不要监听0.0.0.0
: 改为特定ip,例如eth1
--
FROM 101.71.38.*
嗯,感觉lz说的有歧义。
【 在 leelou 的大作中提到: 】
: 是app的对外发起,跟监听没关系的吧
: 【 在 zhangkung 的大作中提到: 】
: : 不要监听0.0.0.0
: ...................
--来自微水木3.5.11
--
FROM 114.242.250.*
如果app主动发起外联,是client。
连接时,可以指定本机ip。
下文的方法3。
Initiate Connection to a Server:
To make a connection to a server, create a new Socket object using one of the following constructors:
- Socket(InetAddress address, int port)
- Socket(String host, int port)
- Socket(InetAddress address, int port, InetAddress localAddr, int localPort)
You see, it requires the IP address/hostname of the server and the port number.
With the first two constructors, the system automatically assigns a free port number and a local address for the client computer. With the third constructor, you can explicitly specify the address and port number of the client if needed. The first constructor is often used because of its simplicity.
【 在 wisedd 的大作中提到: 】
: 比如我有
: eth0 10.0.0.0
: eth1 10.0.1.0
: ...................
--来自微水木3.5.11
--
修改:zhangkung FROM 114.242.250.*
FROM 114.242.250.*