Routes and Rules Ubuntu 18.04.2Ubuntu 18.04.2 LTS - wifi and bluetooth crashesSystem Settings won't start, Ubuntu 18.04.2Can't update Ubuntu 18.04.2
Is it bizarre that a professor asks every student for a 3 inch by 5 inch photograph?
Why did Grima shed a tear?
Continents with simplex noise
What is a word for the feeling of constantly wanting new possessions?
Why does Bane's stock exchange robbery actually work to bankrupt Bruce Wayne?
How did the T-850 still function after it removed its second battery?
iPhone 11 - Leave lock screen after FaceId
Simple code that checks if you're old enough to drive
Are the Shimano Derailleurs sold in Ali Express genuine or fake?
How would a young girl/boy (about 14) who never gets old survive in the 16th century?
Can a planet's magnetic field be generated by non-ferromagnetic metals?
Tikz: Arranging of a Table with Tikz elements
Why is macOS limited to 1064 processes?
Why is the Falcon Heavy center core recovery done at sea?
70 million rials in usurious money
Linux unzip file from script without outputting the unzipped file names
Modeling the Choose function
Reviewer wants me to do massive amount of work, the result would be a different article. Should I tell that to the editor?
Why the job's next_run_time is wrong?
What order of magnitude incoming asteroid could we, in fact, deflect?
Leaving passport in the hotel room
18 month old kicked out of church nursery
Is a new blessing required when taking off and putting back on your tallit?
How to selectively rsync folders while retaining tree structure?
Routes and Rules Ubuntu 18.04.2
Ubuntu 18.04.2 LTS - wifi and bluetooth crashesSystem Settings won't start, Ubuntu 18.04.2Can't update Ubuntu 18.04.2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
Trata-se de um Servidor virtual Hyper-V Ubuntu 18.04 LTS, com cinco interfaces de rede e o squid instalado.
O que eu preciso é que quando alguém utilizar ao serviço de proxy conectando-se no IP que está na interface eth0 a saída para a internet seja através do IP que está na eth0, e assim sucessivamente para as demais interfaces.
Para tornar possível o comportamento crio novas tabelas de rota com rotas default uma para cada interface e routing policies estabelecendo se a conexão for no IP da interface correspondente deve usar a respectiva tabela de rota criada anteriormente.
Resultado do comando ifconfig
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Exemplo de configuração
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
Confiuração Das Rotas
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
Configuração das Regras
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
O problema que estou enfrentando é, ao reiniciar o servidor as regras e as rotas que criei são apagadas, e ao executar um save e após o start na máquina virtual as rotas são apagadas, e apenas uma interface de rede permanence funcionando e a interface que permance funcionando é a interface cujo gateway está na primeira rota default da tabela de roteamento padrão no caso “default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100”, o que preciso é que as configurações de rotas e regras que fiz sejam persistentes mas das referências que consultei e executei os procedimentos não deram resultado.
Resultado ip route show
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Observações:
- Os IPs adicionados na pergunta são fictícios.
- Os IPs devem ser atribuídos via DHCP.
- Quando as rotas e regras são configuradas combinadas com a configuração do Squid o comportamento esperado é alcançado.
---------------------------English Section (Google Translate)-------------------------------------
Google Translate:
It is a Ubuntu 18.04 LTS Hyper-V virtual server, with five network interfaces and squid installed.
What I need is that when someone uses the proxy service connecting to the IP that is in the eth0 interface the output to the internet is through the IP that is in eth0, and so on to the other interfaces.
To make possible the behavior I create new route tables with default routes one for each interface and routing policies establishing if the connection is in the IP of the corresponding interface it must use the respective route table previously created.
ifconfig command result
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Content on
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
IP Route Commands Executed
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
IP Rule Commands Executed
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
Google Translate:
The problem I am facing is, when I restart the server the rules and routes I have created are deleted, and when I execute a save and after the start in the virtual machine the routes are deleted, and only one network interface is still working and the interface that permance running is the interface whose gateway is in the first default route of the default routing table in the case "default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100", what I need is that the route settings and rules I made are persistent but the references I consulted and performed the procedures did not work.
Ip Route Show Commnad
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Comments:
- The IPs added in the question are fictitious.
- IPs must be assigned via DHCP.
- When the routes and rules are configured in combination with the Squid configuration the expected behavior is achieved.
18.04
add a comment
|
Trata-se de um Servidor virtual Hyper-V Ubuntu 18.04 LTS, com cinco interfaces de rede e o squid instalado.
O que eu preciso é que quando alguém utilizar ao serviço de proxy conectando-se no IP que está na interface eth0 a saída para a internet seja através do IP que está na eth0, e assim sucessivamente para as demais interfaces.
Para tornar possível o comportamento crio novas tabelas de rota com rotas default uma para cada interface e routing policies estabelecendo se a conexão for no IP da interface correspondente deve usar a respectiva tabela de rota criada anteriormente.
Resultado do comando ifconfig
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Exemplo de configuração
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
Confiuração Das Rotas
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
Configuração das Regras
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
O problema que estou enfrentando é, ao reiniciar o servidor as regras e as rotas que criei são apagadas, e ao executar um save e após o start na máquina virtual as rotas são apagadas, e apenas uma interface de rede permanence funcionando e a interface que permance funcionando é a interface cujo gateway está na primeira rota default da tabela de roteamento padrão no caso “default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100”, o que preciso é que as configurações de rotas e regras que fiz sejam persistentes mas das referências que consultei e executei os procedimentos não deram resultado.
Resultado ip route show
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Observações:
- Os IPs adicionados na pergunta são fictícios.
- Os IPs devem ser atribuídos via DHCP.
- Quando as rotas e regras são configuradas combinadas com a configuração do Squid o comportamento esperado é alcançado.
---------------------------English Section (Google Translate)-------------------------------------
Google Translate:
It is a Ubuntu 18.04 LTS Hyper-V virtual server, with five network interfaces and squid installed.
What I need is that when someone uses the proxy service connecting to the IP that is in the eth0 interface the output to the internet is through the IP that is in eth0, and so on to the other interfaces.
To make possible the behavior I create new route tables with default routes one for each interface and routing policies establishing if the connection is in the IP of the corresponding interface it must use the respective route table previously created.
ifconfig command result
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Content on
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
IP Route Commands Executed
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
IP Rule Commands Executed
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
Google Translate:
The problem I am facing is, when I restart the server the rules and routes I have created are deleted, and when I execute a save and after the start in the virtual machine the routes are deleted, and only one network interface is still working and the interface that permance running is the interface whose gateway is in the first default route of the default routing table in the case "default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100", what I need is that the route settings and rules I made are persistent but the references I consulted and performed the procedures did not work.
Ip Route Show Commnad
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Comments:
- The IPs added in the question are fictitious.
- IPs must be assigned via DHCP.
- When the routes and rules are configured in combination with the Squid configuration the expected behavior is achieved.
18.04
Added English text
– Graham
May 31 at 16:52
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08
add a comment
|
Trata-se de um Servidor virtual Hyper-V Ubuntu 18.04 LTS, com cinco interfaces de rede e o squid instalado.
O que eu preciso é que quando alguém utilizar ao serviço de proxy conectando-se no IP que está na interface eth0 a saída para a internet seja através do IP que está na eth0, e assim sucessivamente para as demais interfaces.
Para tornar possível o comportamento crio novas tabelas de rota com rotas default uma para cada interface e routing policies estabelecendo se a conexão for no IP da interface correspondente deve usar a respectiva tabela de rota criada anteriormente.
Resultado do comando ifconfig
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Exemplo de configuração
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
Confiuração Das Rotas
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
Configuração das Regras
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
O problema que estou enfrentando é, ao reiniciar o servidor as regras e as rotas que criei são apagadas, e ao executar um save e após o start na máquina virtual as rotas são apagadas, e apenas uma interface de rede permanence funcionando e a interface que permance funcionando é a interface cujo gateway está na primeira rota default da tabela de roteamento padrão no caso “default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100”, o que preciso é que as configurações de rotas e regras que fiz sejam persistentes mas das referências que consultei e executei os procedimentos não deram resultado.
Resultado ip route show
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Observações:
- Os IPs adicionados na pergunta são fictícios.
- Os IPs devem ser atribuídos via DHCP.
- Quando as rotas e regras são configuradas combinadas com a configuração do Squid o comportamento esperado é alcançado.
---------------------------English Section (Google Translate)-------------------------------------
Google Translate:
It is a Ubuntu 18.04 LTS Hyper-V virtual server, with five network interfaces and squid installed.
What I need is that when someone uses the proxy service connecting to the IP that is in the eth0 interface the output to the internet is through the IP that is in eth0, and so on to the other interfaces.
To make possible the behavior I create new route tables with default routes one for each interface and routing policies establishing if the connection is in the IP of the corresponding interface it must use the respective route table previously created.
ifconfig command result
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Content on
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
IP Route Commands Executed
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
IP Rule Commands Executed
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
Google Translate:
The problem I am facing is, when I restart the server the rules and routes I have created are deleted, and when I execute a save and after the start in the virtual machine the routes are deleted, and only one network interface is still working and the interface that permance running is the interface whose gateway is in the first default route of the default routing table in the case "default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100", what I need is that the route settings and rules I made are persistent but the references I consulted and performed the procedures did not work.
Ip Route Show Commnad
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Comments:
- The IPs added in the question are fictitious.
- IPs must be assigned via DHCP.
- When the routes and rules are configured in combination with the Squid configuration the expected behavior is achieved.
18.04
Trata-se de um Servidor virtual Hyper-V Ubuntu 18.04 LTS, com cinco interfaces de rede e o squid instalado.
O que eu preciso é que quando alguém utilizar ao serviço de proxy conectando-se no IP que está na interface eth0 a saída para a internet seja através do IP que está na eth0, e assim sucessivamente para as demais interfaces.
Para tornar possível o comportamento crio novas tabelas de rota com rotas default uma para cada interface e routing policies estabelecendo se a conexão for no IP da interface correspondente deve usar a respectiva tabela de rota criada anteriormente.
Resultado do comando ifconfig
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Exemplo de configuração
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
Confiuração Das Rotas
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
Configuração das Regras
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
O problema que estou enfrentando é, ao reiniciar o servidor as regras e as rotas que criei são apagadas, e ao executar um save e após o start na máquina virtual as rotas são apagadas, e apenas uma interface de rede permanence funcionando e a interface que permance funcionando é a interface cujo gateway está na primeira rota default da tabela de roteamento padrão no caso “default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100”, o que preciso é que as configurações de rotas e regras que fiz sejam persistentes mas das referências que consultei e executei os procedimentos não deram resultado.
Resultado ip route show
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Observações:
- Os IPs adicionados na pergunta são fictícios.
- Os IPs devem ser atribuídos via DHCP.
- Quando as rotas e regras são configuradas combinadas com a configuração do Squid o comportamento esperado é alcançado.
---------------------------English Section (Google Translate)-------------------------------------
Google Translate:
It is a Ubuntu 18.04 LTS Hyper-V virtual server, with five network interfaces and squid installed.
What I need is that when someone uses the proxy service connecting to the IP that is in the eth0 interface the output to the internet is through the IP that is in eth0, and so on to the other interfaces.
To make possible the behavior I create new route tables with default routes one for each interface and routing policies establishing if the connection is in the IP of the corresponding interface it must use the respective route table previously created.
ifconfig command result
eth0: flags=4163 mtu 1500
inet 189.189.10.4 netmask 255.255.255.0 broadcast 189.189.10.255
inet6 fe80::215:5dff:fe5a:425e prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5e txqueuelen 1000 (Ethernet)
RX packets 216690 bytes 15705511 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 62685 bytes 4658403 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163 mtu 1500
inet 189.189.20.4 netmask 255.255.255.0 broadcast 189.189.20.255
inet6 fe80::215:5dff:fe5a:425f prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:5f txqueuelen 1000 (Ethernet)
RX packets 154552 bytes 9944248 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32754 bytes 2319788 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163 mtu 1500
inet 189.189.30.4 netmask 255.255.255.0 broadcast 189.189.30.255
inet6 fe80::215:5dff:fe5a:4260 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:60 txqueuelen 1000 (Ethernet)
RX packets 154485 bytes 9940210 (9.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32836 bytes 2330587 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163 mtu 1500
inet 189.189.40.4 netmask 255.255.255.0 broadcast 189.189.40.255
inet6 fe80::215:5dff:fe5a:4261 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:61 txqueuelen 1000 (Ethernet)
RX packets 117812 bytes 11016717 (11.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34004 bytes 2504658 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth4: flags=4163 mtu 1500
inet 189.189.50.4 netmask 255.255.255.0 broadcast 189.189.50.255
inet6 fe80::215:5dff:fe5a:4262 prefixlen 64 scopeid 0x20
ether 00:15:5d:5a:42:62 txqueuelen 1000 (Ethernet)
RX packets 118058 bytes 7940984 (7.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35226 bytes 2705527 (2.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3101 bytes 159988 (159.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3101 bytes 159988 (159.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Content on
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth2:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth3:
dhcp4: yes
network:
version: 2
renderer: networkd
ethernets:
eth4:
dhcp4: yes
IP Route Commands Executed
ip route add default via 189.189.10.254 dev eth0 table 10
ip route add default via 189.189.20.254 dev eth1 table 20
ip route add default via 189.189.30.254 dev eth2 table 30
ip route add default via 189.189.40.254 dev eth3 table 40
ip route add default via 189.189.50.254 dev eth4 table 50
IP Rule Commands Executed
ip rule add from 189.189.10.4 table 10
ip rule add from 189.189.20.4 table 20
ip rule add from 189.189.30.4 table 30
ip rule add from 189.189.40.4 table 40
ip rule add from 189.189.50.4 table 50
Google Translate:
The problem I am facing is, when I restart the server the rules and routes I have created are deleted, and when I execute a save and after the start in the virtual machine the routes are deleted, and only one network interface is still working and the interface that permance running is the interface whose gateway is in the first default route of the default routing table in the case "default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100", what I need is that the route settings and rules I made are persistent but the references I consulted and performed the procedures did not work.
Ip Route Show Commnad
default via 189.189.50.254 dev eth4 proto dhcp src 189.189.50.4 metric 100
default via 189.189.40.254 dev eth3 proto dhcp src 167.249.40.4 metric 100
default via 189.189.30.254 dev eth2 proto dhcp src 189.189.30.254 metric 100
default via 189.189.10.254 dev eth1 proto dhcp src 189.189.10.254 metric 100
default via 189.189.20.254 dev eth0 proto dhcp src 189.189.20.254 metric 100
Comments:
- The IPs added in the question are fictitious.
- IPs must be assigned via DHCP.
- When the routes and rules are configured in combination with the Squid configuration the expected behavior is achieved.
18.04
18.04
edited Jun 3 at 18:52
Infra IBPT
asked May 31 at 16:42
Infra IBPTInfra IBPT
11 bronze badge
11 bronze badge
Added English text
– Graham
May 31 at 16:52
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08
add a comment
|
Added English text
– Graham
May 31 at 16:52
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08
Added English text
– Graham
May 31 at 16:52
Added English text
– Graham
May 31 at 16:52
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147691%2froutes-and-rules-ubuntu-18-04-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147691%2froutes-and-rules-ubuntu-18-04-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Added English text
– Graham
May 31 at 16:52
@Graham if you choose to do this, then please also remove the old text or, at least, put it in a separate section.
– terdon♦
May 31 at 17:08