# interfaces(5) file used by ifup(8) and ifdown(8) So if you tidy up the interfaces file to # interfaces(5) file used by ifup(8) and ifdown(8) Is there any way to use some kind of "AND" operator to indicate that I want to insert the new line below the Interface description AND five rows below? However I want to insert it were the static routes are located, that is five rows below the interface description and that's my question: That would insert the static route below the interface description #MONITORING Interface. $ sed -i '/MONITORING/a up route add -net X.X.X.X netmask X.X.X.X gw X.X.X.X ' Looks to me that sed can do the job, as we can insert lines before or after a particular pattern, in this case, it could be the Interface's name: To the MTNMGT and MONITORING interface sections of the /etc/network interfaces file. The /etc/network/interfaces file looks like this: # interfaces(5) file used by ifup(8) and ifdown(8) Unfortunately I have no experience on writing bash scripts, but after doing some research I came out with a basic idea on how to solve this problem. Whenever there is a new remote location, we need to manually add static routes to this location on all the servers which is very in efficient, that's why I was looking into creating a bash script to add the new static route of the new location to the /etc/network/interfaces file in the servers. The servers use Ubuntu 18.04 and we use static routing to connect to remotes at customer premises. I'm in charge of 30 backbone servers that are configured with sub-interfaces to connect to different VLANs via a single trunk.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |