Shell
$ man interfaces
...
IFACE OPTIONS
...
up command, post-up command
Run command after bringing the interface up. If this command fails then ifup aborts, re‐
fraining from marking the interface as configured (even though it has really been config‐
ured), prints an error message, and exits with status 0. This behavior may change in the fu‐
ture.
$Shell
$ ip route
2.45.0.0/16 dev enp0s3 proto kernel scope link src 2.45.23.56
$Shell
$ sudo ip route add 45.34.12.78 via 2.45.23.252
[sudo] пароль для user:
$
$ ip route
2.45.0.0/16 dev enp0s3 proto kernel scope link src 2.45.23.56
45.34.12.78 via 2.45.23.252 dev enp0s3
$Shell
$ ping 45.34.12.78
PING 45.34.12.78 (45.34.12.78) 56(84) bytes of data.
64 bytes from 45.34.12.78: icmp_seq=1 ttl=64 time=1.26 ms
64 bytes from 45.34.12.78: icmp_seq=2 ttl=64 time=0.712 ms
64 bytes from 45.34.12.78: icmp_seq=3 ttl=64 time=0.916 ms
64 bytes from 45.34.12.78: icmp_seq=4 ttl=64 time=0.775 ms
^C
--- 45.34.12.78 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3027ms
rtt min/avg/max/mdev = 0.712/0.916/1.261/0.212 ms
$Shell
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto enp0s3
iface enp0s3 inet static
address 2.45.23.56/16
gateway 2.45.23.56
up ip route add 45.34.12.78 via 2.45.23.252
$Shell
$ ip route
2.45.0.0/16 dev enp0s3 proto kernel scope link src 2.45.23.56
$
$
$ ping 45.34.12.78
ping: connect: Сеть недоступна
$