Redirect entire server to a new IP

GoWilkes

Well-Known Member
Sep 26, 2006
554
21
168
cPanel Access Level
Root Administrator
Is there a cPanel method to quickly redirect the entire server to a new server, without relying on DNS changes? It doesn't matter if it's slow, I just need to do it for testing before making the new server live and need to be able to quickly move it back in case of errors.

I think that I can do it with CSF by modifying /etc/csf/csf.redirect with:

Code:
# old server IP | * | new server IP | * | tcp/udp
123.45.67.89|*|987.65.43.21|*|tcp/udp
But before I do that, I wanted to see if there's a WHM/cPanel option that might be faster and easier to change back and forth.

If modifying CSF is the best way, am I correct that it shouldn't affect FTP or SSH? In theory I should be able to change it then restart CSF, and the entire server will redirect. Then if there's an issue I can just remove the line and restart CSF again, and go back to normal. But obviously if it redirects FTP then I wouldn't be able to change it...
 

GoWilkes

Well-Known Member
Sep 26, 2006
554
21
168
cPanel Access Level
Root Administrator
I guess this is just for future readers. But after some digging, I thought that this would work:

Code:
# Port 80 for HTTP
123.45.67.89|80|987.65.43.21|80|tcp
123.45.67.89|80|987.65.43.21|80|udp

# Port 443 for HTTPS
123.45.67.89|443|987.65.43.21|443|tcp
123.45.67.89|443|987.65.43.21|443|udp
This was supposed to only redirect ports 80 and 443.

I changed it and then restarted CSF, but then had internal server errors everywhere and it never redirected. So this didn't work, and there was no explanation for the ISEs in the error logs.