Facebook
From Jakub Rudziński, 2 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 205
  1. K1 - vmnet5
  2. K2 - vmnet6
  3. Bridge - vmnet5, vmnet6, vmnet7
  4. R1 - vmnet7, vmnet9, vmnet10
  5. R2 - vmnet9, vmnet11
  6. K3 - vmnet11
  7. R3 - vmnet10, vmnet12
  8. R4 - vmnet12, vmnet13
  9. Server - vmnet13
  10.  
  11.  
  12. K1
  13.  
  14. ip link set dev eth0 up
  15. ip a a 10.1.0.1/16 dev eth0
  16.  
  17. K2
  18.  
  19. ip link set dev eth0 up
  20. ip a a 10.1.0.2/16 dev eth0
  21.  
  22. Bridge
  23.  
  24. ip link set dev eth0 up
  25. ip link set dev eth1 up
  26. ip link set dev eth2 up
  27. brctl addbr s1
  28. brctl addif s1 eth0
  29. brctl addif s1 eth1
  30. brctl addif s1 eth2
  31. ip link set dev s1 up
  32. echo 1 > /proc/sys/net/ipv4/ip_forward
  33.  
  34. R1
  35.  
  36. ip link set dev eth0 up
  37. ip link set dev eth1 up
  38. ip link set dev eth2 up
  39. ip a a 10.1.0.3/16 dev eth0
  40. echo 1 > /proc/sys/net/ipv4/ip_forward
  41. ip a a 10.2.0.1/16 dev eth1
  42.  
  43. K1
  44.  
  45. ip r a 0/0 via 10.1.0.3
  46.  
  47. K2
  48.  
  49. ip r a 0/0 via 10.1.0.3
  50.  
  51. R2
  52.  
  53. ip link set dev eth0 up
  54. ip link set dev eth1 up
  55. ip a a 10.2.0.2/16 dev eth0
  56. echo 1 > /proc/sys/net/ipv4/ip_forward
  57. ip r a 0/0 via 10.2.0.1
  58. ip a a 10.3.0.1/16 dev eth1
  59.  
  60. K3
  61.  
  62. ip link set dev eth0 up
  63. ip a a 10.3.0.2/16 dev eth0
  64. ip r a 0/0 via 10.3.0.1
  65.  
  66. R1
  67.  
  68. ip a a 10.4.0.1/16 dev eth2
  69.  
  70. R3
  71.  
  72. ip link set dev eth0 up
  73. ip link set dev eth1 up
  74. ip a a 10.4.0.2/16 dev eth0
  75. echo 1 > /proc/sys/net/ipv4/ip_forward
  76. ip a a 80.1.1.1/8 dev eth1
  77.  
  78. R1
  79.  
  80. ip r a 10.3.0.0/16 via 10.2.0.2
  81. ip r a 0/0 via 10.4.0.2
  82.  
  83. R4
  84.  
  85. ip link set dev eth0 up
  86. ip link set dev eth1 up
  87. ip a a 80.1.1.2/8 dev eth0
  88. ip a a 120.1.1.2/8 dev eth1
  89. echo 1 > /proc/sys/net/ipv4/ip_forward
  90.  
  91. Server
  92.  
  93. ip link set dev eth0 up
  94. ip a a 120.1.1.1/8 dev eth0
  95. ip r a 0/0 via 120.1.1.2
  96.  
  97. R3
  98.  
  99. ip r a 120.0.0.0/8 via 80.1.1.2
  100. ip r a 0/0 via 10.4.0.1
  101.  
  102. K1
  103.  
  104. ping 10.4.0.2
  105.  
  106. R3
  107.  
  108. iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
  109.  
  110. K1
  111.  
  112. ping 120.1.1.1
  113.  
  114. Server
  115.  
  116. iptables -P INPUT DROP
  117. iptables -P FORWARD DROP
  118. iptables -P OUTPUT DROP
  119. iptables -A INPUT -80 -j ACCEPT
  120. httpd
  121. iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
  122. iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
  123. iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
  124. iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
  125.  
  126. R3
  127.  
  128. iptables -t nat -A PREROUTING -p tcp --dport 8080 -i eth1 -j DNAT --to-destination 10.3.0.2:80
  129.  
  130. Server
  131.  
  132. lynx 80.1.1.1:8080
  133.  
  134.  
  135.