我刚接触过网络并阅读了RFC791关于IP协议规范的内容,并对2.2 Model of Operation段落提出了一些问题。以下是描述的内容:
The internet module prepares a datagram header and attaches the data
to it. The internet module determines a local network address for
this internet address, in this case it is the address of a gateway.
It sends this datagram
我正试图熟悉java中的数据报系统,目前,我们只使用UDP包。
为了发送消息,我们在DatagramPacket上设置目标ip。
/*
* The fields of this class are package-private since
* DatagramSocketImpl classes needs to access them.
*/
byte[] buf;
int offset;
int length;
int bufLength;
InetAddress address;
int port;
我试图使用iptables标记将所有与目标匹配端口22的本地连接重定向到指定的隧道,但是,有些地方出错了。
1.1.1.1 my public address
2.2.2.2 tunnel public address
1.2.3.4 my local tunnel address
在这里,吐露:
# ip rule show
1: from all fwmark 0x14 lookup 20
# ip route show table 20
default via 1.2.3.4 dev tun0
我在iptables上创建了如下规则:
iptables -t mangle