Skip to main content

How to use my old pc as a Router / FireWall / GateWay

One of the great things you can do with an old computer is to make a server from it.
since i have one i thought why not creating a Router + Gateway + Firewall from it ?
here is what i did :

first off all i installed Debian Lenny on it.
then read several tutrials .
and started to work.

The first thing was setting the Ethernet interfaces correctly (i used 3 old NICs).
while eth0 is the first one
eth1 is connected to Wi-Fi
=== Network configuration ===

my /etc/network/interfaces :


auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255


this was to set the eth0 as fixed ip (static).

i edited my /etc/hosts as (on all the computers:



192.168.0.1 myservername.mydomainname myservername
192.168.0.2 mylaptop.mydomainname mylaptop


=== Samba Shares ===
i edited my /etc/samba/smb.conf (this is not a secure server !)


workgroup = MYDOMAINNAME
netbios name = %h
server string = %h server this is the main computer

[ISO]
path = /mnt/hda2/iso
browsable = yes
writeable = no
guest ok =yes
comment = ISO files

[APT]
path = /mnt/hda2/apt
comment = Deb files
browsable = yes
guest ok=yes



=== Gateway ===

Added new forwarding script to /etc/network/if-up.d/00-firewall
this script forwards all communication from eth0 to eth1.



#!/bin/sh

PATH=/usr/sbin:/sbin:/bin:/usr/bin

#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT


# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

# Masquerade.
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

# Don't forward from the outside to the inside.
iptables -A FORWARD -i eth1 -o eth1 -j REJECT

# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward


=== DHCP SERVER ===

Ive added a dhcp server for diffrent machines :
ive edited the config file :


ddns-update-style none;

#my dns

option domain-name-servers 145.253.2.75, 193.174.32.18;

default-lease-time 86400;
max-lease-time 604800;

authoritative;

# Ips

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.229;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}

To Do :

* Secure samba
* Add Users policies.
* Configure exim

Thanks to :

http://www.aboutdebian.com/network.htm
http://www.aboutdebian.com/lan.htm
http://users.pandora.be/mydotcom/howto/lanconnect/router/linux.htm
www.debian-administration.org/articles/23
http://myrtfm.blogspot.com/

Comments

Popular posts from this blog

ESP32-C6 Wi-Fi Logger with Browser GPS + Heat Map Dashboard

This project is an ESP-IDF firmware for the Seeed Studio XIAO ESP32-C6 that turns the board into a self-hosted, secure Wi-Fi scanning logger. It creates its own access point, serves a responsive HTTPS web UI, logs nearby Wi-Fi access points, optionally tags rows with GPS coordinates (provided by the client browser), and exposes battery status from the on-board LiPo input. The end result is a pocket Wi-Fi “survey” tool: scan, track, export logs as CSV, and generate a heat map view to visualize RSSI vs location. Project overview and feature set: :contentReference[oaicite:1]{index=1} What it does AP + Station mode so the device can serve the dashboard while scanning nearby Wi-Fi networks. HTTPS web interface using a bundled certificate/key for local secure access. Single scan and continuous tracking modes. CSV export for analysis and archiving. Persistent logging to SPIFFS at /spiffs/logs.csv . Battery monitoring via ADC with voltage/percentage/status sh...

סלקום ממש לא כדאי לקנות מאצלכם מודים

סלקום באמת מבאס לגלוש אתכם !! בשעה טובה ומצלחת קניתי מודם סלולארי על מנת שאוכל לגלוש באינטרנט בעזרתו. בעמדת המכירה הציעו לי את מסלול תשלום מראש הידוע כtalkman, מסלול זה התאים לצרכי כך שאוכל לדעת מראש כמה אשלם ובחרתי לבצע את העיסקה. כאשר התחלתי לגלוש לשרתים המספקים תוכן כגון rapidshare , megaupload , zshare ועוד גיליתי כי כתובת הIP ממנה אני גולש חסומה, או עברה את כמות השימוש המותרת אולם זה קורה לפני שאני ביצעתי שימוש כלשהוא. ניסיתי להשתמש בכתובות אחרות באמצעות קבלת כתובת IP אחרת (הוצאה והכנסה של המכשיר נותנת כתובת חדשה), אולם בכל ניסיון הכתובות היו חסומות, כלומר לא יכלתי להשתמש כלל בשירות. נתון זה שהכתבות כבר בשימוש ומי שמתמש בכתובת דינאמיות חסום לא נאמר לי ולא הועלה בעת המכירה. מה שקורה שבכל אתר שאני רוצה להשתמש בו אני חסום ולא יכול להשתמש. דברתי עם מספר חברים שיש להם מודמים כאלה כבר זמן רב , כששאלתי איך לפתור : אמרו כי הבעייה נפתרה לנו ע"י שינוי בתוך המודם ל: ABN = intereal ו זה בשפה המקצועית אומר " IP קבוע" שמחתי ל פתרון ו נגשתי ל סלקום אחרי 30 דקות המתנה...

Ollama Voice Chat — A Local, Talking AI Assistant for Windows

  Ollama Voice Chat — A Local, Talking AI Assistant for Windows I’m excited to share my latest open-source project: Ollama Voice Chat — a simple but powerful local voice chat assistant that runs fully on your machine using open-source AI tools. It lets you talk to a Large Language Model (LLM) and hear its responses spoken back out loud — no cloud APIs, no monthly fees, and full control of your data. 👉 GitHub repository: https://github.com/error0327/ollama-voice-chat 🚀 What Is It? Ollama Voice Chat is an interactive client for Windows that connects to a locally running LLM (via Ollama), converts user speech to text, sends it to the model, and uses Coqui TTS to speak the replies. It includes an automated setup script to streamline installation and configuration. Instead of typing, you can talk to your AI assistant and get spoken answers — great for hands-free use cases, prototyping voice UIs, or just having a more natural interaction with your models. 🧠 Why This Matte...