LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to replace old ip with new ip in ipsec.conf? (http://www.linuxquestions.org/questions/linux-general-1/how-to-replace-old-ip-with-new-ip-in-ipsec-conf-4175448473/)

shams 02-03-2013 12:26 PM

How to replace old ip with new ip in ipsec.conf?
 
I have dialup connection with dynamic ip address, i want to replace the old ip address with the new ip address in the ipsec.conf which is in the 18th line:
Quote:

left=118.23.67.21
This is a code the print the new external ip address with each dialup connection:
Quote:

EXTIF="ppp0"
IFCONFIG=/sbin/ifconfig
AWK=/usr/bin/awk
EXTIP="`$IFCONFIG $EXTIF 2>/dev/null | $AWK \
/$EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"
echo "$EXTIP"
how to use a code with one of cat, echo or sed commands to replace the above line with the ouput of this new ip address?

Thor_2.0 02-03-2013 12:33 PM

Hey there, if I'm not mistaken, just entering this should work

Quote:

su -
(password you the Root, or your password, if you're in the sudorers)
nano /pathto/ipsec.conf
and edit, save and you're done...

Just a suggestion

Thor


All times are GMT -5. The time now is 07:46 AM.