Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ssebastianj
Created March 24, 2016 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssebastianj/572775235dd0845c02d3 to your computer and use it in GitHub Desktop.
Save ssebastianj/572775235dd0845c02d3 to your computer and use it in GitHub Desktop.

Setup

Servidores DNS de Google IP
Primario 8.8.8.8
Secundario 8.8.4.4
Servidores DNS de Arnet IP
Primario 200.45.191.35
Secundario 200.45.48.233

Utilizando servidores DNS de Google

ssebastianj@OpenWrt:~# ping pypi.python.org -c 5
PING pypi.python.org (23.235.46.223): 56 data bytes
64 bytes from 23.235.46.223: seq=0 ttl=53 time=193.271 ms
64 bytes from 23.235.46.223: seq=1 ttl=53 time=199.902 ms
64 bytes from 23.235.46.223: seq=2 ttl=53 time=193.538 ms
64 bytes from 23.235.46.223: seq=3 ttl=53 time=199.981 ms
64 bytes from 23.235.46.223: seq=4 ttl=53 time=197.825 ms

--- pypi.python.org ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 193.271/196.903/199.981 ms
ssebastianj@OpenWrt:~# ping testpypi.python.org -c 5
PING testpypi.python.org (23.235.43.223): 56 data bytes
64 bytes from 23.235.43.223: seq=0 ttl=52 time=274.554 ms
64 bytes from 23.235.43.223: seq=1 ttl=52 time=272.556 ms
64 bytes from 23.235.43.223: seq=2 ttl=52 time=276.324 ms
64 bytes from 23.235.43.223: seq=3 ttl=52 time=275.639 ms
64 bytes from 23.235.43.223: seq=4 ttl=52 time=272.466 ms

--- testpypi.python.org ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 272.466/274.307/276.324 ms

Según GeoIP2 Precision Service Demo la ubicación de la IP 23.235.43.223 pertenece a Fastly en San Francisco, California, USA.
NOTA: Las pruebas las estoy haciendo desde la región NEA de Argentina.

Utilizando servidores DNS de Arnet

ssebastianj@OpenWrt:~# ping pypi.python.org -c 5
PING pypi.python.org (104.156.82.223): 56 data bytes
64 bytes from 104.156.82.223: seq=0 ttl=55 time=67.331 ms
64 bytes from 104.156.82.223: seq=1 ttl=55 time=67.524 ms
64 bytes from 104.156.82.223: seq=2 ttl=55 time=67.353 ms
64 bytes from 104.156.82.223: seq=3 ttl=55 time=67.326 ms
64 bytes from 104.156.82.223: seq=4 ttl=55 time=67.180 ms

--- pypi.python.org ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 67.180/67.342/67.524 ms
ssebastianj@OpenWrt:~# ping testpypi.python.org -c 5
PING testpypi.python.org (23.235.39.223): 56 data bytes
64 bytes from 23.235.39.223: seq=0 ttl=55 time=184.590 ms
64 bytes from 23.235.39.223: seq=1 ttl=55 time=180.622 ms
64 bytes from 23.235.39.223: seq=2 ttl=55 time=182.407 ms
64 bytes from 23.235.39.223: seq=3 ttl=55 time=182.649 ms
64 bytes from 23.235.39.223: seq=4 ttl=55 time=180.000 ms

--- testpypi.python.org ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 180.000/182.053/184.590 ms

Esta vez, GeoIP2 nos dice que la IP 104.156.82.223 de PyPI (no testing) resuelve al ISP Fastly ubicado en San Pablo, Brasil. Bastante más cerca de donde estoy.

DNS Forwarding con OpenWrt

Una alternativa es indicar a dnsmasq que utilice los servidores DNS de Arnet para las solicitudes dirigidas a pypi.python.org. Para ello, se puede ejecutar lo siguiente en una consola SSH conectada al router:

ssebastianj@OpenWrt:~# uci add_list dhcp.@dnsmasq[-1].server='/pypi.python.org/200.45.191.35'
ssebastianj@OpenWrt:~# uci add_list dhcp.@dnsmasq[-1].server='/pypi.python.org/200.45.48.223'
ssebastianj@OpenWrt:~# uci commit dhcp

No estoy seguro cómo funciona Fastly pero según este thread (2013) iban a configurar para que utilice cache invalidation y así, al publicar una nueva versión de un paquete éste se encuentre disponible para ser instalado lo más rápido posible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment