hey guys

I don't know if this is the right place for my post subject

I want to transfer my Fedora OS into router such that the PC has two NICs on it, so i want to connect two computers to this PC and let the Fedora OS acts as a router and make routes between these two PCs.

any one have any idea/tut/steps ...

thanx!!

Dani AI

Generated

A concise, practical supplement to the thread: turning a Fedora PC with two NICs into a router requires four things — configure the interfaces (one facing WAN, one LAN), enable IP forwarding in the kernel (as noted), set up NAT/firewalling so LAN hosts can reach the WAN (building on ’s comment), and optionally provide DHCP/DNS for the LAN. The examples below assume eth0=WAN and eth1=LAN.

Sample interface configs (place in /etc/sysconfig/network-scripts on classic Fedora installations):

/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp

/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.10.1
NETMASK=255.255.255.0

Basic NAT + forwarding with iptables (works on systems using iptables; modern Fedora may use firewalld/nftables — use the distribution-native method there):

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

Persist iptables with the distro’s save mechanism (for example, use iptables-save to write the rules file that is restored at boot). Clients should either receive the router IP as their default gateway via DHCP or be pointed manually to 192.168.10.1.

For DHCP/DNS on the router, a light option is dnsmasq; a minimal dnsmasq.conf for the LAN might specify the LAN interface, a dhcp-range, and the router IP as gateway. For WAN-emulation (as mentioned), use traffic-control tools (tc/netem) rather than routing alone. Final cautions: make forwarding persistent, restrict forwarded/accepted ports to only what’s needed, keep the system updated, and prefer the distro’s firewall tooling (firewalld/nft) on newer Fedora releases.

Recommended Answers

All 2 Replies

huh, it should be simple. just configure and bring up both of your NICs and route other computers through this box. """route ADD destinationIP GatewayPC_IP"""""

if you want this box be able to act like a wide area network simulator then you need some kind of application in it. FreeBSD has dummynet, i guess Fedora you have to download some 3rd party sw.

You will also need to enable IP Forwarding if your going to use the system as a router. in /etc/sysctl.conf, you would add the following lines

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

Then load the changes with "sysctl -p"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.