rewrite all netmask

duke28

Verified User
Joined
Oct 30, 2005
Messages
311
Location
Montreal - Canada
hi

i need to change all netmask of alias ip of 255.255.255.0 to 255.255.255.255

but i have so many ip

i try this :

cd /usr/local/directadmin/data/admin/ips

perl -pi -e 's/\255.255.255.0/\255.255.255.255/' *

but its modify nothing..
i see again 255.255.255.0 in the file of the ip.. in /usr/local/directadmin/data/admin/ips

weird..
what is not ok ?
 
Did you run the ip setup script afterward? Generally anytime you modify a configuration file you have to restart the service using said configuration file.
 
@floyd,

You've managed to lose me, I think. He's just trying to change the file.

@duke28,

The problem is probably the leading \ character in each of the substitution sections. I'd use:
Code:
perl -i.bak -p -e 's/255.255.255.0/255.255.255./ig' *

This will create backup files named *.bak so you can go back if you so need.

Jeff
 
The \ before the 2 is definately not needed and is why it didnt work.
 
@floyd,

You've managed to lose me, I think. He's just trying to change the file.

No point in changing the file if you don't restart the network.

I thought that he thought that if he changed the file then the network would reflect it. That is what I thought when he said nothing was modified.

scsi is right too. The command should be:
Code:
perl -pi -e 's/255.255.255.0/255.255.255.255/' *
 
Last edited:
do you have a option for change new default netmask to 255.255.255.255 ?

not cool to think it each time..

we dont use 255.255.255.0 on my own network..
 
Back
Top