Guest User

Untitled

a guest
Jan 22nd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.71 KB | None | 0 0
  1. $ ifconfig
  2. enp0s20f0u6i1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  3. inet 172.16.0.2 netmask 255.255.0.0 broadcast 172.16.255.255
  4. inet6 fe80::f7f7:80c:8a15:5771 prefixlen 64 scopeid 0x20<link>
  5. ether ee:98:9b:bc:37:ab txqueuelen 1000 (Ethernet)
  6. RX packets 2687 bytes 186674 (182.2 KiB)
  7. RX errors 0 dropped 0 overruns 0 frame 0
  8. TX packets 1648 bytes 176862 (172.7 KiB)
  9. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  10.  
  11. enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
  12. ether c8:5b:76:6b:e4:90 txqueuelen 1000 (Ethernet)
  13. RX packets 0 bytes 0 (0.0 B)
  14. RX errors 0 dropped 0 overruns 0 frame 0
  15. TX packets 0 bytes 0 (0.0 B)
  16. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  17. device interrupt 16 memory 0xf1200000-f1220000
  18.  
  19. lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
  20. inet 127.0.0.1 netmask 255.0.0.0
  21. inet6 ::1 prefixlen 128 scopeid 0x10<host>
  22. loop txqueuelen 1000 (Local Loopback)
  23. RX packets 1982 bytes 177290 (173.1 KiB)
  24. RX errors 0 dropped 0 overruns 0 frame 0
  25. TX packets 1982 bytes 177290 (173.1 KiB)
  26. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  27.  
  28. virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
  29. inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
  30. ether 52:54:00:08:e4:d3 txqueuelen 1000 (Ethernet)
  31. RX packets 0 bytes 0 (0.0 B)
  32. RX errors 0 dropped 0 overruns 0 frame 0
  33. TX packets 0 bytes 0 (0.0 B)
  34. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  35.  
  36. wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  37. inet 192.168.2.106 netmask 255.255.255.0 broadcast 192.168.2.255
  38. inet6 fe80::ebcf:d3b1:5a74:185e prefixlen 64 scopeid 0x20<link>
  39. ether e4:a7:a0:99:2e:8d txqueuelen 1000 (Ethernet)
  40. RX packets 135496 bytes 72791497 (69.4 MiB)
  41. RX errors 0 dropped 0 overruns 0 frame 0
  42. TX packets 51579 bytes 21450089 (20.4 MiB)
  43. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  44.  
  45. pi@MAME82-P4WNP1:~ $ route -n
  46. Kernel IP routing table
  47. Destination Gateway Genmask Flags Metric Ref Use Iface
  48. 0.0.0.0 172.16.0.2 0.0.0.0 UG 0 0 0 usb0
  49. 172.16.0.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0
  50. 172.24.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
  51.  
  52. pi@MAME82-P4WNP1:~ $ ifconfig
  53. lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
  54. inet 127.0.0.1 netmask 255.0.0.0
  55. inet6 ::1 prefixlen 128 scopeid 0x10<host>
  56. loop txqueuelen 1 (Local Loopback)
  57. RX packets 0 bytes 0 (0.0 B)
  58. RX errors 0 dropped 0 overruns 0 frame 0
  59. TX packets 0 bytes 0 (0.0 B)
  60. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  61.  
  62. usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  63. inet 172.16.0.1 netmask 255.255.255.252 broadcast 172.16.0.3
  64. inet6 fe80::cc4b:62ff:fe84:7df0 prefixlen 64 scopeid 0x20<link>
  65. ether ce:4b:62:84:7d:f0 txqueuelen 1000 (Ethernet)
  66. RX packets 1959 bytes 182340 (178.0 KiB)
  67. RX errors 0 dropped 0 overruns 0 frame 0
  68. TX packets 3197 bytes 269463 (263.1 KiB)
  69. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  70.  
  71. wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  72. inet 172.24.0.1 netmask 255.255.255.0 broadcast 172.24.0.255
  73. inet6 fe80::ba27:ebff:fe5e:ceb7 prefixlen 64 scopeid 0x20<link>
  74. ether b8:27:eb:5e:ce:b7 txqueuelen 1000 (Ethernet)
  75. RX packets 0 bytes 0 (0.0 B)
  76. RX errors 0 dropped 0 overruns 0 frame 0
  77. TX packets 14 bytes 1404 (1.3 KiB)
  78. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  79.  
  80. $ route -n
  81. Kernel IP routing table
  82. Destination Gateway Genmask Flags Metric Ref Use Iface
  83. 0.0.0.0 192.168.2.1 0.0.0.0 UG 600 0 0 wlp4s0
  84. 172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp0s20f0u6i1
  85. 192.168.2.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp4s0
  86. 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
  87.  
  88. pi@MAME82-P4WNP1:~ $ cat /etc/resolv.conf
  89. # Generated by resolvconf
  90. nameserver 10.46.0.1
  91. nameserver 8.8.8.8
  92. nameserver 8.8.4.4
  93.  
  94. pi@MAME82-P4WNP1:~ $ cat /etc/network/interfaces
  95. # interfaces(5) file used by ifup(8) and ifdown(8)
  96.  
  97. # Please note that this file is written to be used with dhcpcd
  98. # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
  99.  
  100. # Include files from /etc/network/interfaces.d:
  101. source-directory /etc/network/interfaces.d
  102.  
  103.  
  104. dns-nameservers 8.8.8.8 8.8.4.4
  105.  
  106. auto usb0
  107.  
  108. iface usb0 inet manual
  109.  
  110. auto usb1
  111.  
  112. iface usb1 inet manual
  113.  
  114. $ sudo iptables -L
  115. Chain INPUT (policy ACCEPT)
  116. target prot opt source destination
  117. ACCEPT udp -- anywhere anywhere udp dpt:bootps
  118. ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
  119. ACCEPT udp -- anywhere anywhere udp dpt:domain
  120. ACCEPT tcp -- anywhere anywhere tcp dpt:domain
  121. ACCEPT udp -- anywhere anywhere udp dpt:domain
  122. ACCEPT tcp -- anywhere anywhere tcp dpt:domain
  123. ACCEPT udp -- anywhere anywhere udp dpt:bootps
  124. ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
  125. ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
  126. ACCEPT all -- anywhere anywhere
  127. INPUT_direct all -- anywhere anywhere
  128. INPUT_ZONES_SOURCE all -- anywhere anywhere
  129. INPUT_ZONES all -- anywhere anywhere
  130. DROP all -- anywhere anywhere ctstate INVALID
  131. REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
  132.  
  133. Chain FORWARD (policy ACCEPT)
  134. target prot opt source destination
  135. ACCEPT all -- anywhere 10.42.0.0/24 state RELATED,ESTABLISHED
  136. ACCEPT all -- 10.42.0.0/24 anywhere
  137. ACCEPT all -- anywhere anywhere
  138. REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
  139. REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
  140. ACCEPT all -- anywhere 192.168.122.0/24 ctstate RELATED,ESTABLISHED
  141. ACCEPT all -- 192.168.122.0/24 anywhere
  142. ACCEPT all -- anywhere anywhere
  143. REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
  144. REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
  145. ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
  146. ACCEPT all -- anywhere anywhere
  147. FORWARD_direct all -- anywhere anywhere
  148. FORWARD_IN_ZONES_SOURCE all -- anywhere anywhere
  149. FORWARD_IN_ZONES all -- anywhere anywhere
  150. FORWARD_OUT_ZONES_SOURCE all -- anywhere anywhere
  151. FORWARD_OUT_ZONES all -- anywhere anywhere
  152. DROP all -- anywhere anywhere ctstate INVALID
  153. REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
  154. ACCEPT all -- anywhere anywhere
  155. ACCEPT all -- anywhere anywhere
  156. ACCEPT all -- anywhere anywhere
  157.  
  158. Chain OUTPUT (policy ACCEPT)
  159. target prot opt source destination
  160. ACCEPT udp -- anywhere anywhere udp dpt:bootpc
  161. OUTPUT_direct all -- anywhere anywhere
  162.  
  163. Chain FORWARD_IN_ZONES (1 references)
  164. target prot opt source destination
  165. FWDI_FedoraWorkstation all -- anywhere anywhere [goto]
  166. FWDI_FedoraWorkstation all -- anywhere anywhere [goto]
  167. FWDI_FedoraWorkstation all -- anywhere anywhere [goto]
  168.  
  169. Chain FORWARD_IN_ZONES_SOURCE (1 references)
  170. target prot opt source destination
  171.  
  172. Chain FORWARD_OUT_ZONES (1 references)
  173. target prot opt source destination
  174. FWDO_FedoraWorkstation all -- anywhere anywhere [goto]
  175. FWDO_FedoraWorkstation all -- anywhere anywhere [goto]
  176. FWDO_FedoraWorkstation all -- anywhere anywhere [goto]
  177.  
  178. Chain FORWARD_OUT_ZONES_SOURCE (1 references)
  179. target prot opt source destination
  180.  
  181. Chain FORWARD_direct (1 references)
  182. target prot opt source destination
  183.  
  184. Chain FWDI_FedoraWorkstation (3 references)
  185. target prot opt source destination
  186. FWDI_FedoraWorkstation_log all -- anywhere anywhere
  187. FWDI_FedoraWorkstation_deny all -- anywhere anywhere
  188. FWDI_FedoraWorkstation_allow all -- anywhere anywhere
  189. ACCEPT icmp -- anywhere anywhere
  190.  
  191. Chain FWDI_FedoraWorkstation_allow (1 references)
  192. target prot opt source destination
  193.  
  194. Chain FWDI_FedoraWorkstation_deny (1 references)
  195. target prot opt source destination
  196.  
  197. Chain FWDI_FedoraWorkstation_log (1 references)
  198. target prot opt source destination
  199.  
  200. Chain FWDO_FedoraWorkstation (3 references)
  201. target prot opt source destination
  202. FWDO_FedoraWorkstation_log all -- anywhere anywhere
  203. FWDO_FedoraWorkstation_deny all -- anywhere anywhere
  204. FWDO_FedoraWorkstation_allow all -- anywhere anywhere
  205.  
  206. Chain FWDO_FedoraWorkstation_allow (1 references)
  207. target prot opt source destination
  208.  
  209. Chain FWDO_FedoraWorkstation_deny (1 references)
  210. target prot opt source destination
  211.  
  212. Chain FWDO_FedoraWorkstation_log (1 references)
  213. target prot opt source destination
  214.  
  215. Chain INPUT_ZONES (1 references)
  216. target prot opt source destination
  217. IN_FedoraWorkstation all -- anywhere anywhere [goto]
  218. IN_FedoraWorkstation all -- anywhere anywhere [goto]
  219. IN_FedoraWorkstation all -- anywhere anywhere [goto]
  220.  
  221. Chain INPUT_ZONES_SOURCE (1 references)
  222. target prot opt source destination
  223.  
  224. Chain INPUT_direct (1 references)
  225. target prot opt source destination
  226.  
  227. Chain IN_FedoraWorkstation (3 references)
  228. target prot opt source destination
  229. IN_FedoraWorkstation_log all -- anywhere anywhere
  230. IN_FedoraWorkstation_deny all -- anywhere anywhere
  231. IN_FedoraWorkstation_allow all -- anywhere anywhere
  232. ACCEPT icmp -- anywhere anywhere
  233.  
  234. Chain IN_FedoraWorkstation_allow (1 references)
  235. target prot opt source destination
  236. ACCEPT udp -- anywhere anywhere udp dpt:netbios-ns ctstate NEW
  237. ACCEPT udp -- anywhere anywhere udp dpt:netbios-dgm ctstate NEW
  238. ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ctstate NEW
  239. ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns ctstate NEW
  240. ACCEPT udp -- anywhere anywhere udp dpts:blackjack:65535 ctstate NEW
  241. ACCEPT tcp -- anywhere anywhere tcp dpts:blackjack:65535 ctstate NEW
  242.  
  243. Chain IN_FedoraWorkstation_deny (1 references)
  244. target prot opt source destination
  245.  
  246. Chain IN_FedoraWorkstation_log (1 references)
  247. target prot opt source destination
  248.  
  249. Chain OUTPUT_direct (1 references)
  250. target prot opt source destination
  251.  
  252. auto test0
  253. iface test0 inet static
  254. address 192.168.2.202 -- use your address
  255. netmask 255.255.255.0 -- use your address
  256. and what other entries your system requires.
  257.  
  258. RFC1918 name IP address range largest CIDR block (subnet mask)
  259. 24-bit block 10.0.0.0 – 10.255.255.255 10.0.0.0/8 (255.0.0.0)
  260. 20-bit block 172.16.0.0 – 172.31.255.255 172.16.0.0/12 (255.240.0.0)
  261. 16-bit block 192.168.0.0 – 192.168.255.255 192.168.0.0/16 (255.255.0.0)
  262.  
  263. auto usb0
  264. iface usb0 inet static
  265. address 172.16.0.1
  266. netmask 255.240.0.0
  267. add any other values needed.
  268.  
  269. net.ipv4.ip_forward=1
  270.  
  271. # This connects to the Pi
  272. auto test0
  273. iface test0 inet static
  274. address 172.16.0.2
  275. netmask 255.240.0.0
  276. add any other values needed.
  277.  
  278. # This is the internet connection
  279. auto wlp4s0
  280. iface wlp4s0 inet static
  281. address 192.168.2.106
  282. netmask 255.255.255.255
  283. add any other values needed like
  284. gateway a.b.c.d
  285. dns-nameservers 8.8.8.8 8.8.4.4
  286.  
  287. auto wlp4s0
  288. iface wlp4s0 inet dhcp
  289.  
  290. # this rule will forward all traffic from nic test0 to nic wlp4s0
  291. sudo iptables -A FORWARD -i test0 -o wlp4s0 -j ACCEPT
  292. # this rule will continue to forward any existing connections from test0 to wlp4so
  293. sudo iptables -A FORWARD -i test0 -o wlp4s0 -m state --state ESTABLISHED,RELATED -j ACCEPT
  294.  
  295. # this rule will wrap the packet with a local address so they do not get lost in transit.
  296. sudo iptables -t nat -A POSTROUTING -j MASQUERADE
Add Comment
Please, Sign In to add comment