VLANs In Centos 6
Creating VLANs in centos 6 is simple…well, it’s supposed to be.
1 2 3 4 5 6 7 8 | # cat /etc/sysconfig/network-scripts/ifcfg-eth1.58 VLAN=yes DEVICE=eth1.58 NM_CONTROLLED=no ONBOOT=yes BOOTPROTO=static IPADDR=x.y.z.w NETMASK=a.b.c.d |
For me, though, not so much. I have a CSV with about 200 VLANs that need to be created, so I wrote a quick autoit script to whip up the config files…no biggie.
I then copied them to the server and did a “service network restart”, and It gave me :
Device eth1.58 does not seem to be present, delaying initialization. |
After I banged my head against the wall for a while I found that once the files were on the server if I opened the file, then saved it…it would magically work. I’m not sure what the difference was, but that was it.
You can script it to echo your configs and pipe it with > and >> to file, or perhaps you can just script it to open/save/close each file. Have phun kids!
This is probably because of the End Of Line format.
In every decent editor you can specify if you want Windows, Unix or Mac EOL format.
@Onno, thanks!
dos2unix is your friend if you’re scripting it for centos from a winder$ file.
Next time just do a quick
dos2unix /etc/sysconfig/network-scripts/ifcfg-eth1.58
@Jimmy/Rob
Looks like great minds think alike 😉
This was one of those live and learn things. Nothing Linux ever just goes smooth…always a fight. I don’t fight with my wife, but I sure as hell fight with Linux!