(NOTE: If you had a more complex situation, such as intercepting requests for specific web pages, an alternative solution might be to use "proxy" software. to-destination 127.0.0.1 = tells DNAT what to do replace the original destination with "127.0.0.1". j DNAT = if the rule matches (in this case, if an outgoing packet has destination IP 123.45.67.89), then handle it with DNAT, which alters the destination. d 123.45.67.89 = the original IP address that the packet was going to (its destination). p all = apply to all protocols (tcp, udp, and icmp). If you don't, the rule would create a possible security hole, because matching Incoming packets from remote locations would also be directed to localhost. I did the same on my mac, and it is not working. The problem is, on the PC in my office, I set the 127.0.0.1 point to localhost in the system host file, then I can use localhost/admin to access the application after I started tomcat. SECURITY WARNING: Make sure the rule includes this OUTPUT directive. I am using VPN to connect the tomcat database in my office, everything looks fine. A OUTPUT = append to the list of rules for locally-generated, outgoing, packets. t nat = table for translating one address to another Try this (in place of 123.45.67.89, put the ip_address that needs to be altered): iptables -t nat -A OUTPUT -p all -d 123.45.67.89 -j DNAT -to-destination 127.0.0.1 You want to perform NAT ( Network Address Translation), given the "destination IP" ( e.g. Specifically, you want to change OUTGOING requests from your PC to an IP address ( ), so that they instead go to a different IP address, in this case 127.0.0.1. But to me, the simplest wayconceptually and visuallyis via a graphical user interface like what MAMP offers. Google "explain iptables" for introductory explanations. There are a lot of different ways to do this in Mac OS X. and in my /etc/hosts file I have an entry for each one: vhosts. I have a vhost folder in my Sites folder, and I have a list of folders, such as: recipes.cam database.cam sandbox.cam codeigniter.cam. So Ive set up virtual hosts for my Mac and I do all my development locally on my computer. On Linux, the default firewall is controlled by iptables commands. The answer might be out there, but I cant find it. Hosts file can only be used to associate a domain name with an IP it cannot map IP to IP.Īltering IPs can be done by a firewall.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |