NIC of computer vs NIC of router

suheng

Honorable
Nov 14, 2012
10
0
10,510
Hi All,

Could anyone tell me what is difference between NIC of computer and NIC of router? Both computer and router have RJ45 port NIC.
Are they the same? Which way I can get the details of the difference?

Because recently I want to set up a linux box as a soft router. I want to rout all internet traffic(incomming eth0) in linux box to eth1(which will connect to a switch/router as a NAT port). However, I can not understand if router/switch connect to eth1, how should I treat eth1 in linux box, I mean if I need assign an IP to it? and in other side for example PORT 0 of switch connect to eth1, will PORT 0 also have to assign an IP?
If both need, which means for a cable both side have to set a IP address. and both side have to be normal NIC card and no difference between normal computer NIC and router NIC?


Best Regards,
Heng Su
 
Solution
what software/OS are you using to create the soft router?

a NIC is a NIC no matter if in a PC or router.

connect the eth0 to modem (most likely DHCP)

connect the eth1 to switch (assign an IP like 192.168.1.1 which will become your Gateway IP)

configure the DHCP server to use eth1

the switch will not get an IP accept it is a managed switch

all devices connected to the switch will receive an IP from the Linux box.
what software/OS are you using to create the soft router?

a NIC is a NIC no matter if in a PC or router.

connect the eth0 to modem (most likely DHCP)

connect the eth1 to switch (assign an IP like 192.168.1.1 which will become your Gateway IP)

configure the DHCP server to use eth1

the switch will not get an IP accept it is a managed switch

all devices connected to the switch will receive an IP from the Linux box.
 
Solution

suheng

Honorable
Nov 14, 2012
10
0
10,510
Hi all,


Finally, I notice both side need config the IP address in order both can ping through each other. write down here if others need it as reference.
So if you have computer A with eth1 as outgoing traffic, you need give an IP to it. And for computer B with eth0 or router WAN PORT you need assign another IP to it. And both assigned IP have to be in same subnet.
Also if you want computer A as modem proxy, you need set up DHCPD (Option BIND) to make any cable plugin to eth1 of computer A will auto assign an IP to router WAN PORT or other computer NIC.

Also I ssh to my router and check NICs, however, there are eth0, eth1, vlan0 and vlan1. All of them have no ip assigned. Only br0 (the bridge) have an IP. for br0 I can understand. But how come there is no IP assigned for other NICs.

Now I only to know it works, however I still don't know why. o_O......

Best Regards,
Heng Su
 

suheng

Honorable
Nov 14, 2012
10
0
10,510



wow, thank you so much. Just after my post find you already post, hah.
Actually I am using CentOS as a modem proxy(hope this is not wrong). What I do is I have a 3G dongle. I want NAT this 3G dongle to let others share the internet.
My computer have an NIC named eth0
So I am thinking,
|------------>WAN PORT NIC(normal router or switch)
3G dongle --> ppp0 ---masquerade--> NIC(eth0)-----| (or)
|------------> NIC(ethx, normal pc / laptop with cable)

Indeed, I already configure iptables to nat ppp0 and forward eth0, also I set up DHCP server for eth0. Now it's work properly.

However, I can not get why I have to assign an IP to eth0?


first part in my CentOS [3G dongle --> ppp0 ---masquerade--> NIC(eth0)], this indeed do the job of a normal modem, right?
If I have to assign IP to eth0 then for normal hardware modem the outgoing NIC should also have an IP assigned?

When I root to my router, I found it's funny. Even I plugin a cable to any LAN port, those inner NIC of the router have no IP assigned, how it work like this?

I want to know the details. If you thinking I am lacking much knowledge will waste your time to explain. Please guide me which knowledge I should to read or which book I can get the answer I need. ^_^

Best Regards,
Heng Su


 

suheng

Honorable
Nov 14, 2012
10
0
10,510
*********************************************************|------------>WAN PORT NIC(normal router or switch)
3G dongle --> ppp0 ---masquerade--> NIC(eth0)-----| (or)
*********************************************************|------------> NIC(ethx, normal pc / laptop with cable)
 
i am not sure how it works with a USB modem, but I guess you will use ppp0 to assign the IP automatically to eth0 (WAN) and eth1 (LAN)

the reason the LAN ports of a router do not have a IP assigned to each on is the way it is connected inside.

Picture it this way, you have eth0 as the WAN port and you have an internal eth1 as the LAN port which is connected internally to a switch and an AP (access point). The internal eth1 has the LAN IP assigned to it which shows under the basic setup of the router and is the Gateway IP of the local network.

So what you see on the outside of the router is actually the WAN port (eth0), the 4 ports of the switch, and the antenna of the AP.
 

suheng

Honorable
Nov 14, 2012
10
0
10,510
Hi EmeraId,

Thank you. Seem the router have internal policy to connect every NIC. Anyway I like your answer of first post 'a NIC is a NIC no matter if in a PC or router. '. Indeed this is what I want to know, thank you.

BTW, another question. For a 5 port router(1WAN+4LAN), how many NICs it has? 5 NICs?

Best Regards,
Heng Su
 

suheng

Honorable
Nov 14, 2012
10
0
10,510
hmm... Yes, you are correct. Now I am confused. I have to take a book about router and switch to read them to understand better.

Thank you EmeraId

Best Regards,
Heng Su
 

TRENDING THREADS