10

Can I map 146.112.61.106 IP address to my 127.0.0.1 adress ?

so when I type 146.112.61.106 I got redirected to 127.0.0.1 ? (some netsh command maybe ?)

yarek
  • 797
  • 4
  • 12
  • 21

1 Answers1

14

As you spoke about netsh, I assume that you are working on Windows.

  1. Run cmd.exe as Administrator.
  2. Exec netsh int ip sh int and press "Enter".
  3. Identify your loopback Idx (first column).
  4. Exec netsh int ip add addr <IDX> <IP>/32 st=ac sk=tr and press "Enter". In my case, with IDX=1 I exec: netsh int ip add addr 1 146.112.61.106/32 st=ac sk=tr.
  5. To delete the rule use the command: exec netsh int ip delete addr <IDX> <IP>.

    • st=ac stands for store = active. This means the IP address you are adding to the loopback adapter will automatically disappear upon the next boot of the system. If you need to keep the changes, then change the argument to st=persistent.
    • sk=tr stands for skipassource = true. The man page reads: “skipassource: Do not use the address as source address for any outgoing packet unless explicitly specified. The default value is false.”
    • You can verify that it works by running a sniffer or from command line: tracert -d 146.112.61.106. You must see just one hop.
BrianV
  • 103
  • 4
  • 2
    Great. What if I want to rediretct it to another IP: let say 100.100.100.100 ? – yarek Aug 10 '15 at 08:53
  • You've already asked on Superuser. Don't cross-post. – noitsbecky Aug 10 '15 at 11:24
  • Idem. netsh int ip add addr 1 100.100.100.100/32 st=ac sk=tr – Jose Raul Barreras Aug 10 '15 at 14:58
  • 3
    it is the same: it redirects to local host. What I try to achieve is: 146.112.61.106. redirectsTo-> 37.59.14.123 . I mean one external IP to another external IP redirection. Can this be done with netsh command ? – yarek Aug 10 '15 at 15:16
  • Yarek: That is probably a job for a router but you are breaking the internet standards. That is almost literally never the correct solution to a problem. – Daniel Widrick Aug 11 '15 at 21:52
  • 1
    @DanielWidrick, sometimes the problem is because the network administrator don't want to work, and we need a solution, ok, it isn't a correct solution for a correct scenario. – danilo Aug 24 '19 at 23:10