Uploaded image for project: 'Funtoo Linux'
  1. Funtoo Linux
  2. FL-6303

/etc/init.d/netif.tmpl & support for conf in a single file

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None

      Hi.

      This may seems strange and blasphemy, but in non-trivial network setup it handily to see all netif conf in a single file. For example, our border gateway conf could look like this:

      downstream1 {
       template="interface"
       ipaddr="19.19.115.81/30"
       #gateway="17.21.34.2"
       #nameservers="8.8.8.8"
       trunk="net.eth1"
       vlan="6"
      }
      up1 {
       template="interface"
       ipaddr="8.25.14.2/28"
       trunk="net.eth3"
       vlan="1098"
       route="default via 8.25.14.1 table up1_linknet"
      }
      
      up2 {
       template="interface"
       ipaddr="7.9.7.1/30
       7.9.7.2/29"
       trunk="net.eth3"
       vlan="1097"
       route="default via 7.9.7.9 table up2_1linknet;
       default via 7.9.7.2 table up2_2linknet"
      }
      
      downstream2 {
       template="interface"
       ipaddr="19.19.115.89/29"
       #gateway="17.21.3.2"
       #nameservers="8.8.8.8"
       trunk="net.eth1"
       vlan="51"
      }
      
      downstream3 {
       template="interface"
       ipaddr="9.20.11.3/30"
       #gateway="17.21.3.2"
       #nameservers="8.8.8.8"
       trunk="net.eth1"
       vlan="50"
      } 
      
      eth1 {
       template="interface-noip"
      }
      
      eth3 {
       template="interface-noip"
      }
      eth4 {
       #template="interface-noip"
       template="interface"
       ipaddr="192.168.201.9/29"
       route="10.232.128.0/18 via 192.168.201.10;
       10.232.192.0/18 via 192.168.201.10;
       19.19.11.0/26 via 192.168.201.11 realm users;
       19.19.11.64/26 via 192.168.201.11 realm users;
       19.19.11.160/30 via 192.168.201.11 realm users;
       10.232.0.0/16 via 192.168.201.11"
      }
      
      lan {
       # 1 head Tehuti nic
       template="interface"
       ipaddr="192.168.201.9/29"
       route="10.232.128.0/18 via 192.168.201.10;
       10.232.192.0/18 via 192.168.201.10;
       19.19.11.0/26 via 192.168.201.11 realm users;
       19.19.11.64/26 via 192.168.201.11 realm users;
       19.19.11.160/30 via 192.168.201.11 realm users;
       19.19.11.164/30 via 192.168.201.11 realm users;
       19.19.11.128/25 via 192.168.201.10 realm users;
       10.232.0.0/16 via 192.168.201.11"
      }
      
      mgmt {
       template="interface"
       ipaddr="10.232.0.36/22"
       #gateway="10.232.0.36"
       nameservers="8.8.8.8"
       route="10.232.48.26/32 via 10.232.0.1;
       10.232.0.21/32 via 10.232.0.1;
       19.19.11.34/32 via 10.232.0.23 realm srv;
       19.19.11.35/32 via 10.232.0.251 realm srv;
       19.19.11.36/32 via 10.232.0.25 realm srv;
       19.19.11.37/32 via 10.232.0.249 realm srv;
       19.19.11.39/32 via 10.232.0.24 realm srv;
       19.19.11.41/32 via 10.232.0.21 realm srv;
       19.19.11.42/32 via 10.232.0.22 realm srv;
       19.19.11.43/32 via 10.232.0.39 realm srv;
       19.19.11.44/32 via 10.232.0.40 realm srv;
       19.19.11.47/32 via 10.232.0.44 realm srv;
       19.19.11.50/32 via 10.232.0.33 realm srv;
       19.19.11.51/32 via 10.232.0.35 realm srv"
      }
      

       
      This conf can be read from netif.tmpl with:

      eval "`sed -nre \"/[[:space:]]$interface[[:space:]]\\{[[:space:]]\$/ b show; b; :show n; :show1 /[[:space:]]}[[:space:]]*\$/ q; p; n; b show1\" /etc/conf.d/netif.all `"

      or with something else.

      We have a server with around 100 vlans and editing this count of files not so good as we want . Another example - our another server, when we have bridge on vlans and vlans on bridge - much simpler when this related stuff is placed in the single location.

            Unassigned Unassigned
            lego12239 lego12239
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: