Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_router:iptables [2019-12-08 Sun wk49 12:00] – created baumkp | linux_router:iptables [2023-04-30 Sun wk17 17:43] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag> | ||
=====IPTables Configuration===== | =====IPTables Configuration===== | ||
- | ++++IPTables Configuration|I went down the route of attempting to configure the firewall using NFtables. NFTables has some nice features that look to make it more user friendly than IPTables. | + | I went down the route of attempting to configure the firewall using NFtables. NFTables has some nice features that look to make it more user friendly than IPTables. |
+ | |||
+ | As of year ending 2019 general support and functionality of NFTables is much improved. | ||
+ | |||
+ | <fs smaller>Unfortunately the package version supplied with Ubuntu 16.04 was released in 2015-11, and during my configuration I found some bugs. Also mss clamping is not supported in this version. I tried the Ubuntu 18.04 development version and the previous noted bugs were no longer apparent and mss clamping was supported.</ | ||
+ | |||
+ | **//I have not cross checked this IPTable version against the working NFTables version, and it is definitely out of alignment and untested.// | ||
- | I have not cross checked this IPTable version against the working NFTables version, and it is definitely out of alignment and untested.++++ | ||
- | ++++Sample IPTables configuration| | ||
====Sample IPTables configuration==== | ====Sample IPTables configuration==== | ||
Line 86: | Line 91: | ||
COMMIT | COMMIT | ||
- | </ | + | </ |
====Additional IPTables setup requirements==== | ====Additional IPTables setup requirements==== | ||
- | ++++Additional IPTables setup requirements| | + | |
===Persistent IPTables on Boot and before Network Start-up: | ===Persistent IPTables on Boot and before Network Start-up: | ||
Line 104: | Line 109: | ||
*'' | *'' | ||
- | ++++ | ||
- | ====PPPoE MTU Requirements==== | ||
- | |||
- | The PPPoE connection have various additional overhead to that in a standard Ethernet data field. The maximum length (MTU) of the data field of a standard Ethernet data field is limited 1500 bytes. | ||
- | |||
- | A standard PPPoE connection has an additional overhead of 8 bytes, which limits the MTU to 1492 bytes. However, some ISP (internet service providers) may have additional overheads. To determine the the largest MTU use the ping command. The ping command has a 28 bytes overhead (20 bytes IP header + 8 bytes for ICMP header). So the MTU is the greatest value that can be pinged without a fragmentation error, plus 28 bytes for the ping overhead. For a normal PPPoE connection this would be 1492 - 28 = 1464 bytes. (Note that a problem with this method is that it probably uses an existing modem router that sets the MTU, and it is possible that this setting acts as the limiter.) Some command examples: | ||
- | *'' | ||
- | *'' | ||
- | |||
- | See references: [[https:// | ||
- | |||
- | The MSS is normally just 40 bytes less than the MTU. The MSS is used to avoid IP fragmentation at endpoints of TCP connections. The MSS is just the TCP data size and excludes the IP and TCP headers that are normally 20 bytes each. So normal mss would be 1492 - 40 = 1452 bytes | ||
- | |||
- | Some Ethernet data field overheads to consider: | ||
- | *PPPoE header = 8 bytes | ||
- | *IP header = 20 bytes, but can grow up to 60 bytes with options that are rarely used. | ||
- | *ICMP header = 8 bytes | ||
- | *TCP header = 20 bytes, but like IP can grow to 60 bytes long | ||
- | The Ethernet datafield (MTU) is limited to 1500 bytes and the maximum Ethernet frame size must be 1536 bytes or greater. The following overheads in the Ethernet frame, over the MTU are given for information: | + | ---- |
- | *Preamble = 8 bytes | + | |
- | *Destination MAC = 6 bytes | + | |
- | *Source MAC = 6 bytes | + | |
- | *VLAN header (optional) = 4 btyes | + | |
- | *EtherType/ | + | |
- | *Payload = maximum 1500 bytes (MTU) | + | |
- | *CRC/FCS = 4 bytes | + | |
- | *As can be seen above the Ethernet frame overhead is normally a minimum of 26 bytes and 30 bytes with VLAN (IEEE 802.1Q) tagging. | + | |
- | To set the PPPoE connection mtu edit the following file '' | + | |
- | ====ICMP Filtering==== | + | |
- | There seems to be a lot of conflicting information on filtering ICMP, too much!. ICMP is a fundamental component of IP protocal suite and simply blocking it in entirety is poor practice. In fact IPv6 will not function correctly without ICMP. Some judicious filtering and rate limiting seems the correct solution. The following is some reading on ICMP: | + | |
- | | + | |
- | *[[https:// | + | |
- | *[[https:// | + | |
- | *[[https:// | + | |
- | *[[https:// | + | |
- | *[[http:// | + | |
- | *[[https:// | + | |
- | *[[https:// | + | |
- | *[[https:// | + | |