質問編集履歴
13
みやすくしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -83,6 +83,7 @@
|
|
83
83
|
### 追記1
|
84
84
|
コメントを受けまして、
|
85
85
|
以下のようにeth1(LAN)にrouteを追加するとeth0(WAN)へのpacketはなくなりました。
|
86
|
+
|
86
87
|
```
|
87
88
|
[root@host ~]# ip route add 150.22.10.3/32 dev eth1
|
88
|
-
``
|
89
|
+
```
|
12
追記2を削除しました。routeのcacheが消えていませんでした。
title
CHANGED
File without changes
|
body
CHANGED
@@ -85,11 +85,4 @@
|
|
85
85
|
以下のようにeth1(LAN)にrouteを追加するとeth0(WAN)へのpacketはなくなりました。
|
86
86
|
```
|
87
87
|
[root@host ~]# ip route add 150.22.10.3/32 dev eth1
|
88
|
-
``
|
88
|
+
``
|
89
|
-
### 追記2
|
90
|
-
コメントを受けまして、
|
91
|
-
以下のようにiptablesを設定してもeth0(WAN)へのpacketはなくなりました。
|
92
|
-
```
|
93
|
-
[root@host ~]# iptables -A OUTPUT -t mangle -d 150.22.10.3 -j MARK --set-mark 0x100000
|
94
|
-
[root@host ~]# iptables -A FORWARD -t mangle -d 150.22.10.3 -j MARK --set-mark 0x100000
|
95
|
-
```
|
11
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -82,7 +82,14 @@
|
|
82
82
|
|
83
83
|
### 追記1
|
84
84
|
コメントを受けまして、
|
85
|
-
以下のようにeth1(LAN)にrouteを追加するとeth0(WAN)への
|
85
|
+
以下のようにeth1(LAN)にrouteを追加するとeth0(WAN)へのpacketはなくなりました。
|
86
86
|
```
|
87
87
|
[root@host ~]# ip route add 150.22.10.3/32 dev eth1
|
88
|
+
```
|
89
|
+
### 追記2
|
90
|
+
コメントを受けまして、
|
91
|
+
以下のようにiptablesを設定してもeth0(WAN)へのpacketはなくなりました。
|
92
|
+
```
|
93
|
+
[root@host ~]# iptables -A OUTPUT -t mangle -d 150.22.10.3 -j MARK --set-mark 0x100000
|
94
|
+
[root@host ~]# iptables -A FORWARD -t mangle -d 150.22.10.3 -j MARK --set-mark 0x100000
|
88
95
|
```
|
10
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
### 追記1
|
84
84
|
コメントを受けまして、
|
85
|
-
以下のようにeth1にrouteを追加するとeth0へのパケットはなくなりました。
|
85
|
+
以下のようにeth1(LAN)にrouteを追加するとeth0(WAN)へのパケットはなくなりました。
|
86
86
|
```
|
87
87
|
[root@host ~]# ip route add 150.22.10.3/32 dev eth1
|
88
88
|
```
|
9
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -78,4 +78,11 @@
|
|
78
78
|
nexthop dev eth5 weight 1
|
79
79
|
```
|
80
80
|
150.22.0.0/16はお借りしているvpsサーバーのもつaddressです。
|
81
|
-
srcで指定している150.22.13.3は、iptablesやrouteが設定されている対象のhostです。
|
81
|
+
srcで指定している150.22.13.3は、iptablesやrouteが設定されている対象のhostです。
|
82
|
+
|
83
|
+
### 追記1
|
84
|
+
コメントを受けまして、
|
85
|
+
以下のようにeth1にrouteを追加するとeth0へのパケットはなくなりました。
|
86
|
+
```
|
87
|
+
[root@host ~]# ip route add 150.22.10.3/32 dev eth1
|
88
|
+
```
|
8
タグを追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
7
メッセージを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
### わからないこと
|
6
6
|
クラスターを組んでいるサーバー同士で、global ip addressを使ってWANで通信するところを、LANのinterfaceの経路に変更したのですが、一部WANのinterfaceを使う通信が起きるのはなぜでしょうか。
|
7
|
+
iptablesではLANに向かわせたいpacketを完全に捕捉できていると思うのですが、なぜかWANになってしまいます。
|
7
8
|
|
8
9
|
### 起きている問題
|
9
10
|
eth0がglobal networkのinterfaceです。
|
6
MARKの削除を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,6 +50,10 @@
|
|
50
50
|
102 4576 MARK all -- * * 0.0.0.0/0 0.0.0.0/0 match-set internal-hosts dst MARK set 0x100000
|
51
51
|
0 0 ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match ! 0x100000/0x100000
|
52
52
|
0 0 ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match 0x100000/0x100000
|
53
|
+
[root@host ~]# iptables -t filter -L | grep MARK -B2
|
54
|
+
[root@host ~]# iptables -t nat -L | grep MARK -B2
|
55
|
+
[root@host ~]# iptables -t raw -L | grep MARK -B2
|
56
|
+
[root@host ~]
|
53
57
|
```
|
54
58
|
|
55
59
|
#### ip rule
|
5
iptables 追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,18 +38,18 @@
|
|
38
38
|
|
39
39
|
#### iptables
|
40
40
|
```
|
41
|
-
[root@host ~]# iptables -t mangle -
|
41
|
+
[root@host ~]# iptables -t mangle -nvL | grep MARK -B2 -A2
|
42
|
-
Chain FORWARD (policy ACCEPT)
|
42
|
+
Chain FORWARD (policy ACCEPT 11083 packets, 3982K bytes)
|
43
|
-
target prot opt source destination
|
43
|
+
pkts bytes target prot opt in out source destination
|
44
|
-
MARK all --
|
44
|
+
434K 154M MARK all -- * * 0.0.0.0/0 0.0.0.0/0 match-set internal-hosts dst MARK set 0x100000
|
45
|
+
0 0 ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match ! 0x100000/0x100000
|
46
|
+
1200 251K ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match 0x100000/0x100000
|
45
47
|
--
|
46
|
-
Chain OUTPUT (policy ACCEPT)
|
48
|
+
Chain OUTPUT (policy ACCEPT 104 packets, 11776 bytes)
|
47
|
-
target prot opt source destination
|
49
|
+
pkts bytes target prot opt in out source destination
|
48
|
-
MARK all --
|
50
|
+
102 4576 MARK all -- * * 0.0.0.0/0 0.0.0.0/0 match-set internal-hosts dst MARK set 0x100000
|
51
|
+
0 0 ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match ! 0x100000/0x100000
|
49
|
-
|
52
|
+
0 0 ACCEPT all -- * * 0.0.0.0/0 150.22.10.3 mark match 0x100000/0x100000
|
50
|
-
[root@host ~]# iptables -t nat -L | grep MARK -B2
|
51
|
-
[root@host ~]# iptables -t raw -L | grep MARK -B2
|
52
|
-
[root@host ~]
|
53
53
|
```
|
54
54
|
|
55
55
|
#### ip rule
|
4
MARKを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,14 +38,18 @@
|
|
38
38
|
|
39
39
|
#### iptables
|
40
40
|
```
|
41
|
-
[root@host ~]# iptables -
|
41
|
+
[root@host ~]# iptables -t mangle -L | grep MARK -B2
|
42
|
-
Chain
|
42
|
+
Chain FORWARD (policy ACCEPT)
|
43
|
-
|
43
|
+
target prot opt source destination
|
44
|
-
|
44
|
+
MARK all -- anywhere anywhere match-set internal-hosts dst MARK set 0x100000
|
45
|
-
|
45
|
+
--
|
46
|
-
Chain
|
46
|
+
Chain OUTPUT (policy ACCEPT)
|
47
|
-
|
47
|
+
target prot opt source destination
|
48
|
-
|
48
|
+
MARK all -- anywhere anywhere match-set internal-hosts dst MARK set 0x100000
|
49
|
+
[root@host ~]# iptables -t filter -L | grep MARK -B2
|
50
|
+
[root@host ~]# iptables -t nat -L | grep MARK -B2
|
51
|
+
[root@host ~]# iptables -t raw -L | grep MARK -B2
|
52
|
+
[root@host ~]
|
49
53
|
```
|
50
54
|
|
51
55
|
#### ip rule
|
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,4 +67,6 @@
|
|
67
67
|
nexthop dev eth3 weight 1
|
68
68
|
nexthop dev eth4 weight 1
|
69
69
|
nexthop dev eth5 weight 1
|
70
|
-
```
|
70
|
+
```
|
71
|
+
150.22.0.0/16はお借りしているvpsサーバーのもつaddressです。
|
72
|
+
srcで指定している150.22.13.3は、iptablesやrouteが設定されている対象のhostです。
|
2
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
packetの経路変更ができません
|
body
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
15:38:28.418688 IP 150.22.13.3.sun-sr-https > 150.22.10.3.48112: Flags [.], ack 4010106138, win 270, options [nop,nop,TS val 1732446 ecr 44156350], length 0
|
15
15
|
```
|
16
16
|
|
17
|
+
150.22.13.3と150.22.10.3が内部のhostです。これをWAN用のeth0を使うことなく、eth1以降のLAN用のinterfaceを使って通信をしたいです。
|
18
|
+
|
17
19
|
### 設定した内容
|
18
20
|
ipsetでhostのaddressを登録し、iptablesでOUTPUT CHAINとFORWARD CHAINで宛先がipsetに合致するものをMARKしました。
|
19
21
|
policy based routingでMARKされたpacketをLANのinterfaceに流すといった具合に行いました。
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
### 実現したいこと
|
2
|
-
- 内部のサーバー同士を
|
2
|
+
- 内部のサーバー同士をprivateな通信にさせたいです
|
3
3
|
- globalなnetworkの帯域を消費させたくないと思っています
|
4
4
|
|
5
5
|
### わからないこと
|
@@ -15,8 +15,8 @@
|
|
15
15
|
```
|
16
16
|
|
17
17
|
### 設定した内容
|
18
|
-
ipsetで
|
18
|
+
ipsetでhostのaddressを登録し、iptablesでOUTPUT CHAINとFORWARD CHAINで宛先がipsetに合致するものをMARKしました。
|
19
|
-
policy based routingでMARKされた
|
19
|
+
policy based routingでMARKされたpacketをLANのinterfaceに流すといった具合に行いました。
|
20
20
|
|
21
21
|
#### ipset
|
22
22
|
```
|