• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1iptables-translate -I OUTPUT -p udp -d 8.8.8.8 -j ACCEPT
2nft insert rule ip filter OUTPUT ip protocol udp ip daddr 8.8.8.8 counter accept
3
4iptables-translate -F -t nat
5nft flush table ip nat
6
7iptables-translate -I INPUT -i iifname -s 10.0.0.0/8
8nft insert rule ip filter INPUT iifname "iifname" ip saddr 10.0.0.0/8 counter
9
10iptables-translate -A INPUT -i iif+ ! -d 10.0.0.0/8
11nft add rule ip filter INPUT iifname "iif*" ip daddr != 10.0.0.0/8 counter
12
13ebtables-translate -I INPUT -i iname --logical-in ilogname -s 0:0:0:0:0:0
14nft insert rule bridge filter INPUT iifname "iname" meta ibrname "ilogname" ether saddr 00:00:00:00:00:00 counter
15
16ebtables-translate -A FORWARD ! -i iname --logical-in ilogname -o out+ --logical-out lout+ -d 1:2:3:4:de:af
17nft add rule bridge filter FORWARD iifname != "iname" meta ibrname "ilogname" oifname "out*" meta obrname "lout*" ether daddr 01:02:03:04:de:af counter
18
19ebtables-translate -I INPUT -p ip -d 1:2:3:4:5:6/ff:ff:ff:ff:00:00
20nft insert rule bridge filter INPUT ether type 0x800 ether daddr 01:02:03:04:00:00 and ff:ff:ff:ff:00:00 == 01:02:03:04:00:00 counter
21
22# asterisk is not special in iptables and it is even a valid interface name
23iptables-translate -A FORWARD -i '*' -o 'eth*foo'
24nft add rule ip filter FORWARD iifname "\*" oifname "eth\*foo" counter
25
26# escape all asterisks but translate only the first plus character
27iptables-translate -A FORWARD -i 'eth*foo*+' -o 'eth++'
28nft add rule ip filter FORWARD iifname "eth\*foo\**" oifname "eth+*" counter
29
30# skip for always matching interface names
31iptables-translate -A FORWARD -i '+'
32nft add rule ip filter FORWARD counter
33
34# match against invalid interface name to simulate never matching rule
35iptables-translate -A FORWARD ! -i '+'
36nft add rule ip filter FORWARD iifname "INVAL/D" counter
37