Temporary change local dns host resolution [closed]











up vote
0
down vote

favorite












I reached the point where normal SSH tunneling is not enough, and I need to redirect the desired hostname locally to localhost so that the tunneled http request will have a correct domain name. So far, I was adding localhost aliases in /etc/hosts. However I find it really cumbersome, and ultimately I want to have a script that creates a tunnel and add a local host resolution (and reverts changes in the end).



Is editing of /etc/hosts the only way to go? Or are there other approaches? (programmatically changing /etc/hosts is not really motivating for me)










share|improve this question













closed as unclear what you're asking by harrymc, Burgi, bertieb, K7AAY, Seth Nov 29 at 13:23


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2




    This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
    – Kenster
    Nov 22 at 15:35










  • If we need to modify the local dsn, we can only modify the host file.
    – Daisy Zhou
    Nov 23 at 9:39










  • @Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
    – Uko
    Nov 23 at 14:40















up vote
0
down vote

favorite












I reached the point where normal SSH tunneling is not enough, and I need to redirect the desired hostname locally to localhost so that the tunneled http request will have a correct domain name. So far, I was adding localhost aliases in /etc/hosts. However I find it really cumbersome, and ultimately I want to have a script that creates a tunnel and add a local host resolution (and reverts changes in the end).



Is editing of /etc/hosts the only way to go? Or are there other approaches? (programmatically changing /etc/hosts is not really motivating for me)










share|improve this question













closed as unclear what you're asking by harrymc, Burgi, bertieb, K7AAY, Seth Nov 29 at 13:23


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2




    This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
    – Kenster
    Nov 22 at 15:35










  • If we need to modify the local dsn, we can only modify the host file.
    – Daisy Zhou
    Nov 23 at 9:39










  • @Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
    – Uko
    Nov 23 at 14:40













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I reached the point where normal SSH tunneling is not enough, and I need to redirect the desired hostname locally to localhost so that the tunneled http request will have a correct domain name. So far, I was adding localhost aliases in /etc/hosts. However I find it really cumbersome, and ultimately I want to have a script that creates a tunnel and add a local host resolution (and reverts changes in the end).



Is editing of /etc/hosts the only way to go? Or are there other approaches? (programmatically changing /etc/hosts is not really motivating for me)










share|improve this question













I reached the point where normal SSH tunneling is not enough, and I need to redirect the desired hostname locally to localhost so that the tunneled http request will have a correct domain name. So far, I was adding localhost aliases in /etc/hosts. However I find it really cumbersome, and ultimately I want to have a script that creates a tunnel and add a local host resolution (and reverts changes in the end).



Is editing of /etc/hosts the only way to go? Or are there other approaches? (programmatically changing /etc/hosts is not really motivating for me)







networking ssh dns tunnel hosts-file






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 10:25









Uko

1012




1012




closed as unclear what you're asking by harrymc, Burgi, bertieb, K7AAY, Seth Nov 29 at 13:23


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by harrymc, Burgi, bertieb, K7AAY, Seth Nov 29 at 13:23


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
    – Kenster
    Nov 22 at 15:35










  • If we need to modify the local dsn, we can only modify the host file.
    – Daisy Zhou
    Nov 23 at 9:39










  • @Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
    – Uko
    Nov 23 at 14:40














  • 2




    This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
    – Kenster
    Nov 22 at 15:35










  • If we need to modify the local dsn, we can only modify the host file.
    – Daisy Zhou
    Nov 23 at 9:39










  • @Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
    – Uko
    Nov 23 at 14:40








2




2




This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
– Kenster
Nov 22 at 15:35




This seems like sort of an XY problem question to me. Tunneling HTTP through SSH and editing /etc/hosts is sort of a hack, and it's becoming difficult for you because it's a hack. Whatever it is that you're trying to accomplish, you should think about doing it in a more reasonable way.
– Kenster
Nov 22 at 15:35












If we need to modify the local dsn, we can only modify the host file.
– Daisy Zhou
Nov 23 at 9:39




If we need to modify the local dsn, we can only modify the host file.
– Daisy Zhou
Nov 23 at 9:39












@Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
– Uko
Nov 23 at 14:40




@Kenster, I understand your point. But is there any standard way to have access to certain http resources that are only available from certain networks? One other solution that I can think of is to use a socks proxy, but then if I setup proxy, I cannot interact with the rest of the world
– Uko
Nov 23 at 14:40















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

QoS: MAC-Priority for clients behind a repeater

Ивакино (Тотемский район)

Can't locate Autom4te/ChannelDefs.pm in @INC (when it definitely is there)