반응형
작성일: 2024년 2월 7일

 


장비는 1대 밖에 없는데, 여러 개의 Network node가 서로 다른 MAC address & IP address를 생성하여 Network packet을 만드는 테스트를 해보고 싶다면, 아래와 같이 따라하면 된다.

 

(Case A) 기본 Network Namespace에 가상 Port를 만들기

아래 예시는 3개의 서로 다른 MAC address를 가지는 가상 network interface를 생성하고, 각 가상 network interface에 IP address를 할당하고 ping test하는 것을 보여준다.

 

$ ip link add macvlan1 link enp7s0 type macvlan mode bridge

$ ip link add macvlan2 link enp7s0 type macvlan mode bridge

$ ip link add macvlan3 link enp7s0 type macvlan mode bridge

$ ifconfig macvlan1 10.1.4.11/24

$ ifconfig macvlan2 10.1.4.12/24

$ ifconfig macvlan3 10.1.4.13/24


##
## 위 명령을 수행한 장비의 외부에서 ping을 보내면서 MAC Address가 서로 다르게 보이는지 확인한다.
##
$ ping 10.1.4.11

$ ping 10.1.4.12

$ ping 10.1.4.13

 

 

(Case B)  새 Network Namespace를 만들고, 새로운 Network Namespace에 가상 Port를 만들기

(Case A)처럼 가상 Port를 구성하여 사용했을 때, IP Address를 여러 개 사용할 수 있기는 하지만

1개의 MAC Address에 여러 개 IP Address를 Binding하게 된다.

(가상 포트에서 출발한 IP packet이 enp7s0 물리 포트를 경유해서 다른 장비로 forward되는 경우, 다른 장비에서는 MAC address가 다 똑같이 보인다)

각 IP Address마다 MAC Address를 다르게 할당하도록 하고 싶다면, 각 가상 포트마다 Network namespace를 연결해주어야 한다.

긴 설명보다는 아래 예시를 보는 것이 이해가 빠를 것이다.

 

##  MACVLAN type의 가상 포트를 생성한다.
$  ip link   add macvlan1  link enp2s0  type macvlan  mode bridge

## Network namespace를 생성한다.
$  ip netns  add net1

## 가상 포트 macvlan1을 network namespace net1에 연결한다. (연결한다 = 포함시킨다)
$  ip link   set macvlan1  netns net1

## 가상 포트에 IP address를 설정한다.
$  ip netns  exec net1  ip address  add 10.10.1.222/24  dev macvlan1

## Network namespace 'net1' 내부에서 ping 테스트한다.
$  ip netns  exec net1  /usr/bin/ping 10.10.1.2

## 
## 위 테스트에서 확인할 사항:
##   - 10.10.1.2 장비에서 'arp table'을 확인했을 때, 10.10.1.222의 mac address가
##     enp2s0 포트의 mac address와 다르게 보인다면, 구성과 테스트는 성공 !!
##


##
## 테스트가 끝났으면 가상 포트(MACVLAN Port)를 삭제한다.
##
$  ip netns  exec net1  ip link del macvlan`

 

 


 

Linux OS에서 virtual networking을 제공하는 방식이 여러 가지가 있는데, 이론적인 내용은 아래 Web docs를 참고.

(RedHat 공식 문서)

https://developers.redhat.com/blog/2018/10/22/introduction-to-linux-interfaces-for-virtual-networking

 


 

반응형

 

작성일: 2023년 8월 1일

 

NAVER D2 자료 - TCP/IP Network Stack 이해하기

https://d2.naver.com/helloworld/47667

 

 

 

 

 

 

 

반응형

아래 명령 예시처럼 수행하면, tcp syn과 reset 패킷을 확인할 수 있다.

 

$ tcpdump -i enp1s0 -nN "tcp[tcpflags] == tcp-syn or tcp[tcpflags] == tcp-rst"

16:55:16.516453 IP 65.49.1.10.42458 > 112.169.87.89.87: Flags [S], seq 3730493766, win 65535, length 0
16:55:19.755480 IP 140.99.191.218.57246 > 112.169.89.88.26720: Flags [S], seq 417367123, win 1024, length 0
16:55:19.960898 IP 140.99.191.218.57246 > 112.169.89.88.26720: Flags [R], seq 417367124, win 1200, length 0
16:55:19.991267 IP 185.11.61.225.44794 > 112.169.89.88.38956: Flags [S], seq 163297978, win 1024, length 0
16:55:20.146215 IP 185.11.61.225.44794 > 112.169.89.88.38956: Flags [R], seq 163297979, win 1200, length 0
16:55:38.865833 IP 140.99.191.218.57246 > 112.169.89.88.19331: Flags [S], seq 523253283, win 1024, length 0

 

반응형

Testbed network을 만들기 위해 L2, L3가 되는 10G 스위치를 구입했다.

구입하면서 고려했던 것은 이렇다.

  • 10Gbps 지원 (4 Port 이상)
  • 1Gbps 포트 24개 이상
  • VLAN 지원
  • Memory가 넉넉하게 장착되서 모든 Network Port의 Bandwidth가 Full Speed가 나올 것
  • LACP(Link Aggregation Control Protocol) 지원
  • 일반적으로 많이 사용되는 L3(라우팅) 프로토콜 모두 지원.  RIP, OSPF 등.
  • IPv4, IPv6 Routing 지원
  • Web UI 지원
  • DHCP 지원

위 조건을 만족하면서 적당하게 가격이 싼 제품을 찾아보니 "NEXTU 3424GL3-10G"가 가장 적절했다.

위 리스트에 기재한 것 이상으로 많은 기능을 제공하고, CISCO 또는 Arista 등 대중적인 스위치가 제공하는 L2, L3 스위칭 기능을 모두 제공한다고 보면 된다.

 

50만원 미만에 이 정도로 훌륭한 스위칭 성능과 기능을 제공하다니~   

아주 만족하고 있다.

 

 

 

 

# TODO:  WEB UI 화면 캡처해서 붙여넣고 설명하기.

반응형

 

C language, Go(Golang), Netfilter, Netlink를 이용하여 Linux network을 제어하고 모니터링하는 방법을 알아보자~

 

 

개념 이해하기: Netfilter hooks into Linux networking packet flows

The following schematic shows packet flows through Linux networking:

 

From:  https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks

 

 


Linux Netfilter + C example code

참고 문서:   https://pr0gr4m.github.io/linux/kernel/netfilter/
  이론 설명과 함께 잘 동작하는 예시가 있어서 쉽게 이해할 수 있다.
  아래는 위 블로그의 끝 부분에 있는 HTTP Traffic만 선별하여 Drop하는 예제 코드인데,
  그냥 이 예제 코드만 봐도 이해할 수 있을 것이다.

 

http_netfilter.c

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/netdevice.h>

static unsigned int hook_http(void *priv,
		struct sk_buff *skb, const struct nf_hook_state *state)
{
	struct iphdr *iph;
	struct tcphdr *th;
	char *data = NULL;
	int length = 0;
	
	if (!skb)
		return NF_ACCEPT;

	iph = ip_hdr(skb);

	if (iph->protocol == IPPROTO_TCP) {
		th = tcp_hdr(skb);

		length = skb->len - iph->ihl * 4 - th->doff * 4;
		if (length <= 4)
			return NF_ACCEPT;

		data = kzalloc(length, GFP_KERNEL);
		memcpy(data, (unsigned char *)th + th->doff * 4, length);

		if (strstr(data, "HTTP") != NULL) {
			printk("[Kernel:%s] HTTP Detected\n", __func__);
			kfree(data);
			return NF_DROP;
		}

		kfree(data);
	}

	return NF_ACCEPT;
}

static struct nf_hook_ops *nf_ops = NULL;

static int __init nfilter_init(void)
{
	nf_ops = (struct nf_hook_ops *)kzalloc(sizeof(struct nf_hook_ops), GFP_KERNEL);
	nf_ops->hook = (nf_hookfn *)hook_http;
	nf_ops->pf = PF_INET;
	nf_ops->hooknum = NF_INET_LOCAL_IN;
	nf_ops->priority = NF_IP_PRI_FIRST;

	nf_register_net_hook(&init_net, nf_ops);
	printk("[Kernel:%s] NFilter Init\n", __func__);
	return 0;
}

static void __exit nfilter_exit(void)
{
	nf_unregister_net_hook(&init_net, nf_ops);
	kfree(nf_ops);
	printk("[Kernel:%s] NFilter Exit\n", __func__);
}

module_init(nfilter_init);
module_exit(nfilter_exit);
MODULE_LICENSE("GPL");

 

Makefile

obj-m += http_netfilter.o

KDIR := /lib/modules/$(shell uname -r)/build

default:
	$(MAKE) -C $(KDIR) M=$(PWD) modules

CC := gcc

%.c%:
	${CC} -o $@ $^

clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean
	rm -f ${TARGETS}

 

Build & Test

##
## HTTP Server 장비에서 아래 명령을 수행.
##

$ make

$ sudo insmod http_netfilter.ko

$


---

##
## 다른 PC에서 아래와 같이 HTTP Traffic을 발생시켜본다.
##
$ curl -v http://my-test.server.domain/

*   Trying my-test.server.domain:80...
* Connected to my-test.server.domain port 80 (#0)
> GET / HTTP/1.1
> Host: my-test.server.domain
> User-Agent: curl/7.77.0
> Accept: */*
> ##
## TCP Session만 수립될 뿐, 
## 실제 HTTP Response 패킷을 받지 못해서 이 상태로 계속 남아있다가 Timed out 처리된다.
##
* Recv failure: Operation timed out
* Closing connection 0
curl: (56) Recv failure: Operation timed out
$


---

##
## HTTP Server 장비에서 아래 명령을 수행.
##

$ dmesg --color --follow
... 중간 생략 ..
[264707.035282] [Kernel:hook_http] HTTP Detected
[264711.387549] [Kernel:hook_http] HTTP Detected
... 중간 생략 ..

 

 

 

 

 

 


Netlink for C language

Wikipedia

Netlink Protocol Library Suite (libnl)

Core Library Developer's Guide (libnl)

Routing Library Developer's Guide (libnl-route)

Example Collection

 

 

 

위 문서를 읽고 나서, 아래 예제를 테스트하면서 이해하기.

$  cat detect_chg_event.c


/**
 * How to build
 *   $  gcc -o detect_chg_event detect_chg_event.c
 * How to run
 *   $  ./detect_chg_event
 */

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>


static int
create_sock (const char *nic)
{
    struct sockaddr_nl addr;
    int                sock;

    memset (&addr, 0, sizeof (addr));
    addr.nl_family = AF_NETLINK;
    addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;

    sock = socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
    if (sock < 0)
    {
        fprintf (stderr, "failed to open NETLINK_ROUTE socket for %s - %s(%d)",
                nic, strerror (errno), errno);
        return -1;
    }

    if (bind (sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
    {
        fprintf (stderr, "failed to bind NETLINK_ROUTE socket for %s - %s(%d)",
                nic, strerror (errno), errno);
        close (sock);
        return -1;
    }

    return sock;
}


/**
 * NOTE: Cheeck if NIC status is changed
 */
static int
ip_changed (int         sock,
			const char *nic)
{
    struct nlmsghdr   *nlh;
    char               buffer[4096];
    int                len;
    int                idx;
    int                found;

    len = recv (sock, buffer, sizeof (buffer), 0);
    if (len <= 0)
    {
        fprintf (stderr, "NETLINK_ROUTE socket recv() failedn");
        return -1;
    }

    printf("\n %s %s(%d) Receive message from raw socket \n",
            __func__, __FILE__, __LINE__);

    found = 0;
    idx = if_nametoindex (nic);

    printf("\n %s %s(%d) Index of %s: %d \n",
            __func__, __FILE__, __LINE__, nic, idx);

    for (	nlh = (struct nlmsghdr *) buffer;
            NLMSG_OK (nlh, len);
            nlh = NLMSG_NEXT (nlh, len))
    {
        if (nlh->nlmsg_type == NLMSG_DONE)
            break;
        if (nlh->nlmsg_type == NLMSG_ERROR)
            continue;
        if (!(NLMSG_OK (nlh, len)))
            continue;

        printf("\n %s %s(%d) Netlink MSG Type: %d\n",
                __func__, __FILE__, __LINE__, nlh->nlmsg_type);

        /*
         * NOTE:
         *   RTM_NEWADDR, RTM_NEWLINK 에 관한 정의는 rtnetlink.h 파일에서 확인할 수 있다.
         *     - /usr/include/linux/rtnetlink.h
         */
        switch (nlh->nlmsg_type)
        {
            case RTM_NEWADDR:
                {
                    struct ifaddrmsg *ifa = (struct ifaddrmsg *)NLMSG_DATA (nlh);

                    if (ifa->ifa_index == idx)
                        found = 1;
                }
                break;
            case RTM_NEWLINK:
                {
                    struct ifinfomsg *ifi = (struct ifinfomsg *)NLMSG_DATA (nlh);

                    if (ifi->ifi_index == idx)
                        found = 1;
                }
                break;
            default:
                break;
        }
    }

    return found;
}


static int
get_nic_addr (  const char     *nic,
				struct ifaddrs *ifaddr,
				int             wanted_family,
				char           *host,
				int             host_len,
				int            *active)
{
    struct ifaddrs *ifa;

    for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
    {
        int family;
        int s;

        if (ifa->ifa_addr == NULL)
            continue;

        if (strcmp (ifa->ifa_name, nic))
            continue;

        /* Skip unwanted families. */
        family = ifa->ifa_addr->sa_family;
        if (family != wanted_family)
            continue;

        *active = (ifa->ifa_flags & IFF_RUNNING) ? 1 : 0;

        s = getnameinfo (   ifa->ifa_addr,
                            family == AF_INET ? sizeof (struct sockaddr_in) :
                            sizeof (struct sockaddr_in6),
                            host,
                            host_len,
                            NULL,
                            0,
                            NI_NUMERICHOST);
        if (s != 0)
        {
            fprintf (stderr, "failed to getnameinfo() for '%s - %s(%d)",
                    ifa->ifa_name, strerror (errno), errno);
            continue;
        }

        /* Get the address of only the first network interface card. */
        return 1;
    }

    return 0;
}


static void
print_ip (const char *nic)
{
    struct ifaddrs *ifaddr;
    char            addr[NI_MAXHOST];
    int             active;

    printf("\n %s(%d) nic: %s \n",
            __FILE__, __LINE__, nic);

    if (getifaddrs (&ifaddr) == -1)
    {
        fprintf (stderr, "failed to getifaddrs() - %s(%d)", strerror (errno), errno);
        return;
    }

    // NOTE: IPv4
    if (!get_nic_addr (nic, ifaddr, AF_INET, addr, sizeof (addr), &active))
    {
        // If IPv4 configuration is not available,
        // then try to get the Ipv6 configuration.
        printf("\n %s(%d) nic: %s  addr: %s  active: %d \n",
                __FILE__, __LINE__, nic, addr, active);
        // NOTE: IPv6
        if (!get_nic_addr (nic, ifaddr, AF_INET6, addr, sizeof (addr), &active))
        {
            // Nothing to do.
            strcpy (addr, "127.0.0.1");
            active = 0;
        }
    } else {
        printf("\n %s(%d) nic: %s  addr: %s  active: %d \n",
                __FILE__, __LINE__, nic, addr, active);
    }

    freeifaddrs (ifaddr);

    printf("\n %s %s(%d) %s is %s (link %s) \n",
            __func__, __FILE__, __LINE__,
            nic, addr, active ? "active" : "inactive");
}


int
main (void)
{
    // FIXME: enp7s0 --> my machine's network interface name
    char *nic = "enp7s0";
    int   sock;

    print_ip (nic);

    sock = create_sock (nic);
    if (sock < 0)
        return -1;

    while (1)
    {
        int ret;

        ret = ip_changed (sock, nic);
        if (ret < 0)
            return -1;

        if (ret)
            print_ip (nic);

        printf("\n\n %s %s(%d) END OF LOOP \n\n\n",
                __func__, __FILE__, __LINE__);
    }

    close (sock);

    return 0;
}


$

$  gcc -o detect_chg_event detect_chg_event.c

$  ./detect_chg_event

ip_changed detect_chg_event.c(73) Receive message from raw socket

 ip_changed detect_chg_event.c(79) Index of enp7s0: 2

 ip_changed detect_chg_event.c(93) Netlink MSG Type: 16

 detect_chg_event.c(181) nic: enp7s0

 detect_chg_event.c(205) nic: enp7s0  addr: 10.1.4.51  active: 1

 print_ip detect_chg_event.c(211) enp7s0 is 10.1.4.51 (link active)


 main detect_chg_event.c(239) END OF LOOP
 
 ...
 ...

 

위 예제에서 detect_chg_event 명령을 실행시켜 놓고, 아래와 같이 명령을 실행해본다.

$  ifconfig  enp7s0  mtu 1501
$  ifconfig  enp7s0  mtu 1500
$  ifconfig  enp7s0  down
$  ifconfig  enp7s0  up

detect_chg_event 예제 앱이 enp7s0 장치의 상태 변화를 감지해서 터미널에 감지한 내용을 출력해줄 것이다.

 

Netlink library for go

https://github.com/vishvananda/netlink

 

 


 

 

https://tomdnetto.net/post/linux_networking_from_go_nftables

 

Linux Networking From Go

Manipulating network interfaces, firewalling, and forwarding from Go.

tomdnetto.net

 

 

https://tomdnetto.net/post/advanced_nftables_with_go

 

Advanced NFTables With Go

NFTables like your mama taught you.

tomdnetto.net

 

 

 

반응형

 

참고할 문서

CISCO SDN  (www.oss.kr에서 download한 pdf 문서)

https://www.oss.kr/editor/file/3bd27047/download/99fb53a9-31c4-46f9-91ad-79eeaa927f16

위 문서에서 중요한 부분만 발췌한 내용 (아래)

Application Centric Infra (CISCO)

 

 

ACI VMM 아키텍처 - Openstack Neutron ML2

 

 


 

 

ACI & Kubernetes – The Cisco K8s CNI

CISCO ACI와 Kubernetes 조합으로 Network를 구성하고 싶다면, 아래  Documents를 참고할 것.

 

ACI & Kubernetes - The Cisco K8s CNI (Part One) - Haystack Networks

A look and review of the integration between Cisco ACI, Kubernetes and the Cisco K8 CNI.

haystacknetworks.com

 

 

 

Enable Consistent Application Services for Containers

Seamless developer experience intended to maintain the simplicity of Kubernetes while still enabling advanced capabilities within the Cisco ACI fabric, and maintaining application availability, security, and visibility across the infrastructure.

blogs.cisco.com

 

YouTube 영상: Kubernetes integration with CISCO ACI

 

 

 

 

ACI Networking Plugin for Kubernetes

https://pubhub.devnetcloud.com/media/netdevops-live/site/files/s01t07.pdf

 

 

 

ACI CNI Plugin (GitHub Source Code)

 

 

GitHub - noironetworks/aci-containers: Plugins for integrating ACI with container orchestration systems

Plugins for integrating ACI with container orchestration systems - GitHub - noironetworks/aci-containers: Plugins for integrating ACI with container orchestration systems

github.com

 

 

 

 

EPG, Contract, AP(Application Profile), BD(Broadcast Domain) 등 개념이 머릿속에 잘 그려지지 않아서 

이런 개념을 Use Case로 그린 Diagram만 우선 보고자 한다.

 

Cisco ACI Multi-Site Architecture White Paper (2021-11-23)

 

Cisco Application Centric Infrastructure - Cisco ACI Multi-Site Architecture White Paper

Cisco Application Centric Infrastructure (Cisco ACI) as a pervasive fabric technology, enterprises and service providers commonly need to interconnect separate Cisco ACI fabrics.

www.cisco.com

 

 

Cisco Application Centric Infrastructure - White Papers

Cisco Application Centric Infrastructure - white papers

www.cisco.com

 

 

EPGs and Preferred Groups

 

 

Referencing objects across templates and across schemas

 

Specific strat egy to define templates inside a schema

 

Layer 3 intra-V RF Layer 3 communication across sites

 

 

Intra-VRF Layer 3 communication across sites stretching an EPG

 

Layer 3 inter-VRF communication across sites

 

Inter-VRF communication across sites (shared services)

 

Interconnecting Cisco ACI fabrics for Layer 3 communication via L3Outs

 

Initial state: layer 3 intersite communication using the L3Out path

 

Issue when mixing VXLAN and L3Out traffic paths

 

 

Use cases for integrating Cisco ACI Multi-Pod and Cisco ACI Multi-Site

 

Single network infrastructure offering both IPN and ISN connectivity

 

Hierarchical MP -BGP EVPN peering

 

Multi-Site and traditional L3Out connections on border leaf nodes

 

Use of a stretched external EPG (Ext-EPG)

 

 

Multi-Site and traditional L3Out connections with a stretched bridge domain

 

Cisco ACI EPG-based network model

 

 

An example of stretched application between on-premises Cisco ACI and cloud sites

 

 

An example of stretched EPGs across sites

 

An example of intersite shared services

 

 

An example of Cloud L3Out

 

An example of On-Premises L3Out for cloud endpoints

 

 

On-premises service chaining for a stretched application tier

 

 

 

 

Cisco ACI policy model (Tenant, VRF, BD, EPG, EndPoint, Taboo, Contracts, Pod, Path, Node)

 

 

 

 

반응형

 


작성일: 2023년 10월 15일

 


[ 강의 동영상 ]
계영수 님이 GNS3 강의 동영상을 만든지 4년이 지나서 지금 GNS3 버전과 GUI 구성이 조금 달라서 헷갈릴 수 있지만,
이 동영상이 큰 도움이 된다.

  https://www.youtube.com/playlist?list=PL30o9a_lTg-KN4UmwKj2txuY3Vrd1nMrx

 

 


GNS3 및 CISCO Switch 명령 예제 모음

 

 

테스트할 때마다 사용하는 명령을 명령어 수행 순서대로 기록해보았다.

 

 

CISCO Switch Port에 IP Address 설정하기

##
## CISCO Switch Port에 IP Address 설정하기
## 

R1# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)# interface fastEthernet 0/0

R1(config-if)# ip address 10.1.1.1 255.255.255.0

R1(config-if)# no shutdown 

R1(config-if)# end
*Jul  2 21:14:42.231: %SYS-5-CONFIG_I: Configured from console by console

R1# ping 10.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/30/68 ms

R1#

 

 

CISCO Switch Loopback Port에 IP Address 설정하기

R1# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)# interface loop0
R1(config-if)#
*Jul  3 12:59:03.859: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

R1(config-if)# ip address 1.1.1.1 255.255.255.255
R1(config-if)# end
R1#
*Jul  3 12:59:45.647: %SYS-5-CONFIG_I: Configured from console by console
R1#

 

 

CISCO Switch에 BGP 설정하기

##
## AS 100을 관리하는 라우터(R1) 설정
##

R1# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)# router bgp 100
R1(config-router)# neighbor 10.1.1.2 remote-as 200
R1(config-router)# end
R1#
*Jul  3 13:05:03.939: %SYS-5-CONFIG_I: Configured from console by console
R1#


##
## AS 200을 관리하는 라우터(R2) 설정
##

R2# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)# router bgp 200
R2(config-router)# neighbor 10.1.1.1 remote-as 100
R2(config-router)# end
R2#
*Jul  3 13:07:28.543: %SYS-5-CONFIG_I: Configured from console by console
R2#
*Jul  3 13:07:35.307: %BGP-5-ADJCHANGE: neighbor 10.1.1.1 Up 
R2#

 

 

BGP 설정 내용 확인하기

##
## 간략한 BGP 정보를 보는 명령
##

R1# show ip bgp summary

BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.1.2        4          200       7       7        1    0    0 00:02:53        0


##
## 상세한 BGP Neighbor 정보를 보는 명령
##

R1# show ip bgp neighbors 
BGP neighbor is 10.1.1.2,  remote AS 200, external link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:05:43   ## <-- state 값을 확인해야 함.
  Last read 00:00:20, last write 00:00:14, hold time is 180, keepalive interval is 60 seconds
  Neighbor sessions:
    1 active, is not multisession capable (disabled)
  Neighbor capabilities:
    Route refresh: advertised and received(new)
    Four-octets ASN Capability: advertised and received
    Address family IPv4 Unicast: advertised and received
    Enhanced Refresh Capability: advertised and received
    Multisession Capability: 
    Stateful switchover support enabled: NO for session 1
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
    
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                1          1
    Keepalives:             8          8
    Route Refresh:          0          0
    Total:                 10         10
  Default minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  Session: 10.1.1.2
  BGP table version 1, neighbor version 1/0
  Output queue size : 0
  Index 1, Advertise bit 0
  1 update-group member
  Slow-peer detection is disabled
  Slow-peer split-update-group dynamic is disabled
                                 Sent       Rcvd
  Prefix activity:               ----       ----
    Prefixes Current:               0          0
    Prefixes Total:                 0          0
    Implicit Withdraw:              0          0
    Explicit Withdraw:              0          0
    Used as bestpath:             n/a          0
    Used as multipath:            n/a          0

                                   Outbound    Inbound
  Local Policy Denied Prefixes:    --------    -------
    Total:                                0          0
  Number of NLRIs in the update sent: max 0, min 0
  Last detected as dynamic slow peer: never
  Dynamic slow peer recovered: never
  Refresh Epoch: 1
  Last Sent Refresh Start-of-rib: never
  Last Sent Refresh End-of-rib: never
  Last Received Refresh Start-of-rib: never
  Last Received Refresh End-of-rib: never
				       Sent	  Rcvd
	Refresh activity:	       ----	  ----
	  Refresh Start-of-RIB          0          0
	  Refresh End-of-RIB            0          0

  Address tracking is enabled, the RIB does have a route to 10.1.1.2
  Connections established 1; dropped 0
  Last reset never
  Transport(tcp) path-mtu-discovery is enabled
  Graceful-Restart is disabled
Connection state is ESTAB, I/O status: 1, unread input bytes: 0            
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1
Local host: 10.1.1.1, Local port: 37711
Foreign host: 10.1.1.2, Foreign port: 179
Connection tableid (VRF): 0
Maximum output segment queue size: 50

Enqueued packets for retransmit: 0, input: 0  mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x118E84):
Timer          Starts    Wakeups            Next
Retrans            10          0             0x0
TimeWait            0          0             0x0
AckHold             9          6             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            1          0        0x157854
DeadWait            0          0             0x0
Linger              0          0             0x0
ProcessQ            0          0             0x0

iss: 1109643795  snduna: 1109644028  sndnxt: 1109644028
irs:  864525182  rcvnxt:  864525415

sndwnd:  16152  scale:      0  maxrcvwnd:  16384
rcvwnd:  16152  scale:      0  delrcvwnd:    232
          
SRTT: 737 ms, RTTO: 2506 ms, RTV: 1769 ms, KRTT: 0 ms
minRTT: 48 ms, maxRTT: 1000 ms, ACK hold: 200 ms
Status Flags: active open
Option Flags: nagle, path mtu capable
IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):
Rcvd: 19 (out of order: 0), with data: 10, total data bytes: 232
Sent: 20 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 10, total data bytes: 232

 Packets received in fast path: 0, fast processed: 0, slow path: 0
 fast lock acquisition failures: 0, slow path: 0
TCP Semaphore      0x6AA22B60  FREE 

R1#

 

 

IP Routing Table 정보 조회하기

R1# show ip route 

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.1.1.0/24 is directly connected, FastEthernet0/0
L        10.1.1.1/32 is directly connected, FastEthernet0/0

R1#

 

 

BGP 이용하여 Network Route 광고(Advertisement)

##
## R1 라우터가 이웃 라우터에게 Advertisement하기
##

R1# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)# router bgp 100
R1(config-router)# network 1.1.1.1 mask 255.255.255.255   ## <-- Route 광고하기
R1(config-router)# end
*Jul  3 14:26:39.559: %SYS-5-CONFIG_I: Configured from console by console
R1#


##
## 이웃 라이터(예: R2)에서 수신한 Route Advertisement 정보를 확인
##

R2# show ip bgp summary 
BGP router identifier 2.2.2.2, local AS number 200
BGP table version is 2, main routing table version 2
1 network entries using 148 bytes of memory
1 path entries using 64 bytes of memory
1/1 BGP path/bestpath attribute entries using 136 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 372 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.1.1        4          100      83      82        2    0    0 01:11:20        1  ## <- 이 값이 1로 변경되었는지 확인
R2#

 

 

BGP Network Route 광고 정보 조회

##
## 라우터 R1에서 BGP 정보 조회
##

R1# show ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.1/32       0.0.0.0                  0         32768 i
 R1#
 
 
##
## 라우터 R2에서 BGP 정보 조회
##

R2# show ip bgp
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.1/32       10.1.1.1                 0             0 100 i
R2#

 

 

 

 

 

 

 

반응형

 


 

작성일: 2023년 9월 19일

 

어찌저찌 하다가 얻어 걸린 정보라서 메모를 해둔다.  (곧 까먹을 것 같아서...)

 

##
## Google 검색어 입력란(Text Box)에 아래 문장을 입력하고 검색하기.
##

intitle:index.of ios parent directory bin

 

위 검색어로 검색하면, 아래와 같은 결과가 출력될 것이다.

 

 

검색 결과에 여러 웹 사이트가 있지만, 아래 웹 사이트 가장 괜찮은 것 같다.

 

 

Index of /pustaka/docs/GNS3/images

 

lms.onnocenter.or.id

 

위 웹 사이트에서 CISCO C7200 Router에 대한 ios를 다운로드한 후, 아래 동영상을 보면서 따라하면 아주 쉽게 GNS3에 Router Image를 등록할 수 있다.

 

 

 

 

+ Recent posts