Ir ao conteúdo

Compartilhar internet com servidor na porta WAN.

Boa tarde,

Os ultimos dias passei instalando o servidor e com uns problemas para configurar o mesmo. Eu sabia como configurar a rede para funcionar da seguinte maneira:

MODEM -> (eth0) Servidor (eth1) -> (Porta lan) Router (Portas lan) -> Computadores

Porém não era essa topologia que eu desejava, pois com está eu perdia a porta WAN do meu roteador. Então decidi fazer a seguinte:

MODEM -> (eth0) Servidor (eth1) -> (Porta WAN) Router (Portas LAN) -> Computadores

Inicialmente, deixei meu servidor ligado somente ao modem e testei se o mesmo conseguia pingar a internet. Até o momento tudo ok.

Acessei o arquivo “/etc/network/interfaces” e configurei a eth1 manualmente da seguinte maneira:

auto eth1
iface eth1 inet static
address 192.168.100.254
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255

Logo em seguida adicionei as regras de iptables:

sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING –out-interface eth0 -j MASQUERADE
iptables -A FORWARD –in-interface eth0 -j ACCEPT

Teoricamente o compartilhamento de internet já devia estar funcionando. Mas não foi isso que aconteceu. Resolvi acessar o meu Roteador pela Lan e configura-lo manualmente da seguinte maneira:

IP Address : 192.168.100.1
Subnet Mask : 255.255.255.0
ISP Gateway Address : 192.168.100.254
Primary DNS Address : 200.247.141.11 (DNS VIRTUA SC)
Secondary DNS Address : 200.247.141.12 (DNS VIRTUA SC)

Salvei as modificações, esperei o mesmo ser reiniciado e pronto. Conexão funcionando.

Eu sei que isso não ficou como um tutorial, ficou um “relato” mas este relato pode lhe ajudar a configurar se você seguir os mesmos passos que eu. Lembre-se também que as regras de iptables devem ser executadas sempre na inicialização do servidor. Saiba mais sobre Executar scripts ao iniciar computador.

Demorei bastante tempo e testei várias configurações para que conseguisse tudo funcionando mas acredito que o meu maior problema foi ter usado a mesma Classe de IPS para a rede interna (atrás do roteador) e a “externa” (comunicação entre o roteador e servidor).

Qualquer problema com Compartilhamento ou coisas do tipo, não hesite em perguntar.

Espero que este artigo seja de grande ajuda,
Matheus

Agradecimentos ao Ubuntu Forum que me deu uma ajuda.

Publicado emAprendendoLinux

125 Comentários

  1. Букмекерские конторы: отзывы, ставки на спорт, новости спорта, прогнозы и
    черно море читайте подробнее про ставки и букмекеров на bkradar.com

  2. DichaelTiemi DichaelTiemi

    Hello, I think your site might be having browser compatibility issues. When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!
    tada gaming games

  3. Букмекерские конторы: отзывы, ставки на спорт, новости спорта, прогнозы и
    академия пушкаша читайте подробнее про ставки и букмекеров на bkradar.com

  4. Platforma obsługuje wygodne formy płatności, w tym BLIK kompatybilny z bankami mBank, ING, PKO BP, Pekao i Millennium, a także popularne karty Visa i Mastercard (Maestro). Pozytywne opinie użytkowników publikowane w serwisach Trustpilot oraz Opinie.com potwierdzają wysoki poziom zaufania do marki. Miłośnicy gry na smartfonach mogą korzystać z dedykowanej aplikacji dostępnej na urządzenia z systemem iOS oraz Android, która zapewnia płynną i stabilną rozgrywkę. Slottica to nie tylko polskie kasyno internetowe, lecz także przestrzeń, w której możesz cieszyć się grą i wygrywać na własnych zasadach.

  5. EarnestCot EarnestCot

    What’s up to every one, as I am actually eager of reading this weblog’s post to be updated on a regular basis. It carries fastidious data.
    แทงหวย

  6. EarnestCot EarnestCot

    Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but other than that, this is fantastic blog. A great read. I will certainly be back.
    หวยออนไลน์

  7. IsmaelFlolo IsmaelFlolo

    Hi there! This post could not be written any better! Reading through this post reminds me of my good old room mate! He always kept talking about this. I will forward this page to him. Fairly certain he will have a good read. Thank you for sharing!
    casino retrait instantane

  8. EarnestCot EarnestCot

    Awesome website you have here but I was wondering if you knew of any message boards that cover the same topics talked about in this article? I’d really like to be a part of online community where I can get feedback from other knowledgeable individuals that share the same interest. If you have any suggestions, please let me know. Kudos!
    Bookmaker sans limite de mise

  9. LewisJonus LewisJonus

    Your writing flows incredibly well, and the transition between different points was smooth. This is exactly the kind of trustworthy and unbiased content I enjoy reading on a weekday.

    no deposit bonus

  10. DichaelTiemi DichaelTiemi

    Thank you for taking the time to put this complete overview together, as it really helps clarify a lot of the questions I had regarding this topic and provides a solid foundation for further exploration.

    no deposit bonus

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *