Skip to contentSkip to conversation

'ip route' and 'ipset'...

DISCUSSION Marco Gaiarin 3 participants 4 messages Jan 31, 2020

lore
Share & tools
lore
#0 lore raw

There's a way to use 'ipset' (eg, host list) in a route, eg 'ip route' and/or 'ip rule'?

Thanks.

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''          http://www.lanostrafamiglia.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
      http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#1 lore raw

Hi,

Quoted 2 lines · Marco Gaiarin

There's a way to use 'ipset' (eg, host list) in a route, eg 'ip route' and/or 'ip rule'?

Not to my knowledge, but you may use nftables' route type chains to implement policy routing in nftables which supports sets natively. If any of paket mark, source or destination address or TOS fields are changed by a rule in route type chain, routing decision will be redone for the packet.

Cheers, Phil

#2 lore raw
In reply to Marco Gaiarin

Mandi! Phil Sutter
In chel di` si favelave...

Quoted 1 line

Not to my knowledge,

OK.

Quoted 5 lines

but you may use nftables' route type chains to
implement policy routing in nftables which supports sets natively. If any of paket mark, source or destination address or TOS fields are changed by a rule in route type chain, routing decision will be redone for the packet.

Aaahh... i've forgot to specify: it is 'local' traffic, so i've no 'PREROUTE' and 'POSTROUTE' to mark to...

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''          http://www.lanostrafamiglia.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
      http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#3 lore raw
In reply to Marco Gaiarin

Hello
If you want to reroute local traffic, you can match packets with ipset and mark them in raw/OUTPUT table to change the route decision.

Quoted 27 lines · Marco Gaiarin

Mandi! Phil Sutter
In chel di` si favelave...

Quoted 1 line

Not to my knowledge,

OK.

Quoted 5 lines

but you may use nftables' route type chains to
implement policy routing in nftables which supports sets natively. If any of paket mark, source or destination address or TOS fields are changed by a rule in route type chain, routing decision will be redone for the packet.

Aaahh... i've forgot to specify: it is 'local' traffic, so i've no 'PREROUTE' and 'POSTROUTE' to mark to...

--
dott. Marco Gaiarin GNUPG Key ID: 240A3D66
Associazione ``La Nostra Famiglia'' http://www.lanostrafamiglia.it/
Polo FVG - Via della Bontà, 7 - 33078 - San Vito al Tagliamento (PN)
marco.gaiarin(at)lanostrafamiglia.it t +39-0434-842711 f +39-0434-842797

Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)

Signature · 1 line
Anton Danilov.