BGP Port TCP 179 ????

Unanswered Question
Mar 1st, 2007


I want to use some other port for BGP instead TCP 179 . how cam i do it ???


I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3.7 (3 ratings)
CSCO10892433 Fri, 03/02/2007 - 02:56

Hi, afzaalq007

I wonder there is any possibilty to do that. I think the reasoning for that is inter-operability. BGP typically runs between different autonomous system. If each AS use a different TCP port, it is very difficult for them to establsh a successful session, let alone exchange routing information between them.



afzaalq007 Fri, 03/02/2007 - 03:43


plz chk the output i have pasted below.

Connection state is ESTAB, I/O status: 1, unread input bytes: 0

Local host: CC.BB.NN.YY, Local port: 179

Foreign host: AA.BB.CC.DDD, Foreign port: 12303

Local host is my router and froign host is my upsteram service provider.... ???

How can i do the for my BGP port ???


CSCO10892433 Fri, 03/02/2007 - 19:08

Hi, afzaalq007

In this case, when your ISP's router start talking BGP, it radomly generates a port number,(in this case, 12303) and send a TCP SYN packet with source port 12303 and destination port 179 to your router, which happens to listen on port 179. Your router send a SYN ACK packet with source port 179 and destination port 12303 to the ISP router. The ISP ack back again with source port 12303 and destination port 179. Finally the TCP connection is establsihed and both router can exchange BGP nessages on that connection.

Both the port numbers 12303 and 179 are not configurable on your router. One is randomly generated and the other is fixed on BGP code. You don't have to worry about the port numbers because BGP will take care of them.

For your reference, attached are two debugging outputs(debug ip tcp packet and debug ip tcp transaction) which I test it on a Dynamips lab.



John Patrick Lopez Sat, 03/03/2007 - 10:26

I thought BGP connects thru port 179? But I also have the same result. The source port is 179 instead of destination? But the iBGP peer has the inverted TCP connection which specifies 179 as the destination port.

MSFC01#sh tcp brief

TCB Local Address Foreign Address (state)

43582464 ESTAB


RTR#sh tcp brie

TCB Local Address Foreign Address (state)

81815BB8 ESTAB


ruwhite Mon, 03/05/2007 - 05:11

One router in a BGP peering session will always have the source port as 179, and the destination port as some ephemeral port. The other router will always have the source port as an ephemeral, and the destination port as 179. This is the way any TCP connection should work....

Why is this? Because TCP sessions are always identified by the two ip addresses + the two port numbers. If two devices connected across the same source and destination ports to start a service, there would be no way to start a second TCP session to carry the same service at the same time (a more common instance than you might think--for instance, HTTP may have up to 20 TCP connections to a single server running at the same time).

The first BGP speaker to send an open will use an ephemeral port to connect from, and port 179 to connect to. The other speaker will simply use the ports as they are given, rather than starting a second TCP session.... Note that if both speakers start a session at the same moment (roughly speaking), the one with the higher ID will keep it's session open, and the one with the lower ID will close it's session, so there's always only one TCP session open between the two speakers.




Danilo Dy Mon, 03/05/2007 - 06:54

In TCP/IP, source port is always random and you can't change it as it is generated by the application/system. The destination port is a fixed number for well known services and you can change it to any port if the application/system permits or configurable

From PCMAG...

Source Ports

The source port, which can be a random number, is assigned to the client and is used to keep track of user sessions. The combination of port number and IP address is called a "socket."

Destination Ports

The destination port is used to route packets on a server to the appropriate network application. For example, port 80 is the standard port number for HTTP traffic, and port 80 packets are processed by a Web server. Destination ports are typically well-known ports (0-1023) for common Internet applications such as HTTP, FTP and SMTP. It can also be a registered port (1024-49151) that vendors use for proprietary applications.

Source Becomes Destination and Vice Versa

On the return trip response from the server, the destination port number and IP address become the source port number and IP address. Likewise, the source port and IP become the destination port and IP.

We're Listening

The software that responds to a port number is said to be "listening" for its packets. More accurately, the term should be "looking" for its packets, because it is comparing numbers, not "listening" to numbers. However, computer terminology has never been known for clarity. See well-known port,2542,t=well-known+port&i=54409,00.asp port forwarding,2542,t=port+forwarding&i=49509,00.asp, TCP/IP,2542,t=TCPIP&i=52614,00.asp, Unix socket,2542,t=Unix+socket&i=53469,00.asp and NAT,2542,t=NAT&i=47635,00.asp.


This Discussion