Portál AbcLinuxu, 16. července 2025 15:17
/etc/network/interfaces
mám zatím toto:
#mapping eth0 # script ??? # map ??? eth0-home # map ??? eth0-other #iface eth0-home inet static # address 192.168.1.5 # netmask 255.255.255.0 # network 192.168.1.0 # gateway 192.168.1.1 #iface eth0-other inet dhcpDotaz zní: Jak mám upravit sekci mapping, aby tučňák při nahazování sítě poznal, jak ji má zkonfigurovat?
auto eth0 mapping eth0 script /etc/network/mapping map home eth0-home # map michal eth0-michal map dhcp eth0-dhcp # doma iface eth0-home inet static pre-up cp -f /etc/network/resolv.conf.mistral /etc/resolv.conf address 192.168.4.82 netmask 255.255.255.0 gateway 192.168.4.81 up route add -net 192.168.0.0/16 gw 192.168.4.250 eth0 down route del -net 192.168.0.0/16 gw 192.168.4.250 eth0 ## u michala #iface eth0-michal inet static # address 192.168.3.2 # netmask 255.255.255.0 # gateway 192.168.3.13 # dhcp iface eth0-dhcp inet dhcp
#!/bin/bash dir=/etc/network case $1 in eth0) preset_map=$dir/map.eth0 ;; wlan0) preset_map=$dir/map.wlan0 ;; esac iface="$1" which="" while read map device do # pokud zarizeni jiz zname, tak uz dal nehledame, jen budeme cist stdin if [ "$which" ] then continue fi # koukneme, jestli zarizeni odpovida predvolbe if [ "`grep -e "$map" $preset_map`" == "$map" ] then wich=$device fi done echo $wich
$ ll /etc/network/map* -rw-rw-r-- 1 root ifaces 5 2005-03-23 18:12 /etc/network/map.eth0 -rwxr-xr-x 1 root root 422 2004-11-07 21:52 /etc/network/mapping -rw-rw-r-- 1 root ifaces 7 2005-03-29 13:33 /etc/network/map.wlan0a groupa ifaces obsahuje usery, kteri maji pravo prepinat profily
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.