Question

I am trying to setup Squid proxy server on my Ubuntu 12.04. There are lot of tutorials on that and I am following them one by one till I get success.

In each tutorial, they have asked to issue commands like below:

modprobe ip_gre
ip tunnel add wccp0 mode gre remote 187.72.34.82 local 192.168.1.2 dev eth0
ifconfig wccp0 192.168.1.2 netmask 255.255.255.255 up
echo 0>/proc/sys/net/ipv4/conf/wccp0/rp_filter
echo 0>/proc/sys/net/ipv4/conf/eth0/rp_filter
echo 1>/proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i wccp0 -p tcp --dport 80 -j REDIRECT --to-port 3129
iptables -t nat -A POSTROUTING -j MASQUERADE

If that particular tutorial does not work, I have to revert these (non working) changes to their default. My questions are:

  1. Are these commands supposed to be issued via terminal ?
  2. If I simply reboot the machine, will these changes go away ?
  3. If not, what can I do to reset them to their default ?
  4. If I find some set of commands working for me(and if these changes vanish after each reboot), how can I apply them automatically after each reboot ?

Please note that I am a complete beginner having 1 day's experience in Linux.

Was it helpful?

Solution

  1. Yes, or via a script (see 4 below)
  2. Yes
  3. (no answer as 2. is yes)
  4. Write them to a script and run such at boot time (propably from /etc/rc.local)

OTHER TIPS

When you have the line below, it means that you are writing value 0 on /proc/sys/net/ipv4/conf/wccp0/rp_filter file.

Linux stores all configurations in files, contrary of Windows which stores them in registry (regedit).

As our mate told you before, you can simply write them in a script file and add a call to it in /etc/rc.local depending on what distribution are you working in.

If you apply those commands and don't work as they were supposed to, just have to find out the right file and remove the changes.

I personally recomend you to backup the files below:

cp /proc/sys/net/ipv4/conf/wccp0/rp_filter /home/user
cp /proc/sys/net/ipv4/conf/eth0/rp_filter /home/user
cp /proc/sys/net/ipv4/ip_forward /home/user

If you have only one rule configured into iptables you can run the command below:

iptables -F

The command above will clean all configurations made in iptables, make sure you know what you are doing.

About this you can simply change up by down

ifconfig wccp0 192.168.1.2 netmask 255.255.255.255 up

ifconfig wccp0 192.168.1.2 netmask 255.255.255.255 down

modprobe command doesn't change so much, because it's just loading the module ip_gre

modprobe ip_gre

And the last one, change add by del

ip tunnel add wccp0 mode gre remote 187.72.34.82 local 192.168.1.2 dev eth0

ip tunnel del wccp0 mode gre remote 187.72.34.82 local 192.168.1.2 dev eth0

Hope these information were helpful !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top