I've read that router input ports accept incoming packets and that output ports transmit the packets on the link. However, a link can be used for carrying packets in both ways and in a router there is one port for every link, so isn't that port used sometimes as an input and sometimes as an output?
4 Answers
Unless it's something really special, yes, all network ports on any network device are bidirectional. After all, most communications requires sending messages both ways, even if the traffic in one direction is only a short request and some acknowledgements of data received. (Which is pretty much what your usual TCP HTTP(S) connection is.) If we're only looking at Ethernet, the connections are also symmetric (unlike many DSL connections that are faster in one direction).
While you can have applications like real-time video streaming, where retransmissions wouldn't be useful, you seldom have just those running on the link, so you need those two directions anyway.
On the other, most fiber links utilize swappable transceiver modules (e.g. SFP+, QSFP28, etc.) and there are such modules with only the receiver side. Even then, the port on the device likely supports bidirectional communication.
But if you're looking at a diagram of how a single packet is transmitted through a router, you might see some port labeled in ingress (input) and another labeled as egress (output). It's just that for the next packet the roles may well be reversed.
In general interfaces can be divided into three categories.
- A simplex interface can only transmit data in one direction.
- A half-duplex interface can transmit data in both directions but not at the same time.
- A full-duplex interface can transmit and receive data at the same time. This may be achieved in various ways. Two completely seperate physical channels may be used for the different directions (e.g. 100BASE-TX, and most fiber Ethernet), echo cancellation techniques may be used (e.g. 1000BASE-T, 10GBASE-T) different frequencies or wavelengths may be used (e.g. "BiDi" fiber systems and many radio systems)
In practice the majority of interfaces seen on routers and other network equipment today are full duplex. Simplex interfaces are unheard of in the computer networking world (though they do exist in other applications, like TV broadcasting). Wi-Fi and some old versions of Ethernet were half duplex, but they are unlikely to be directly connected to a serious router today.
The problem with a simplex interface is that traffic routing and handling of faults is much more difficult. With a duplex interface, the two devices can verify that the link is working and can exchange metadata about what destinations can be reached via the interface. With a simplex interface that information would have to be carried via another means.
The problem with a half-duplex system is you need a mechaism to manage the sharing of the medium. That will often impose performance penalties and/or limit the distance of the link. It also makes it more complex to incorporate repeaters in the link as those repeaters must be intelligent enough to track the current direction of transmission.
What I do find a bit surprising is we don't see more asymmetric full duplex interfaces, there are many applications where the predominant flow of traffic is in one direction yet other than some standards used for home and small business "broadband" services, all of the standard interfaces I'm aware of are symmetric with the same data rate in both directions.
You may be confusing physical network interfaces (ports) with TCP/UDP procotol ports (logical ports such as port 80, 443, etc.) which are often used in conjunction with the concepts of inbound or outbound traffic flows, destinations etc.
Physical network device ports are almost always bidirectional or at least capable of working in bidirectional fashion.
In most network device configurations, when you discuss logical TCP or UDP ports (or other IP protocols that may be associated with specifici ports), it is often in reference to inbound or outbound traffic flows that either originate from a given port or are destined to a given port such as HTTP traffic that is usually destined to TCP port 80. In which case, someone might be concerned with 'opening TCP port 80 inbound' to allow a device to accept incoming requests for an HTTP web server. This is not related specifically to the hardware network interfaces on any device that might be part of the network of the server.