diff --git a/README.md b/README.md index 7b12c81..0331c67 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ NIC 의 ip 설정이 미리 되어 있어야 합니다. # 사용 방법 +## 로컬에 자동 PBR 시스템 구성 + 스크립트는 아래 명령어로 다운로드 받을 수 있습니다 ```bash @@ -20,3 +22,21 @@ wget -O policy_routing.py https://git.dmslab.xyz/dmslab/policy-routing/-/raw/mai # or curl -o policy_routing.py https://git.dmslab.xyz/dmslab/policy-routing/-/raw/main/policy_routing.py ``` + +다운로드한 스크립트를 install 옵션으로 시스템 데몬으로 설치할 수 있습니다 + +```bash +sudo python3 policy_routing.py install +``` + +실제 인터페이스가 감지되고 수행이 되었는지 체크할 수 있습니다. + +```bash +sudo python3 policy_routing.py status +``` + +ip rule 을 확인하여 정책 기반 라우팅이 설정되었는지 확인할 수 있습니다. + +```bash +ip rule ls +``` \ No newline at end of file diff --git a/packer-openstack-ubuntu.json b/packer-openstack-ubuntu.json new file mode 100644 index 0000000..4c37010 --- /dev/null +++ b/packer-openstack-ubuntu.json @@ -0,0 +1,65 @@ +{ + "variables": { + "openstack_auth_url": "{{env `OS_AUTH_URL`}}", + "openstack_username": "{{env `OS_USERNAME`}}", + "openstack_password": "{{env `OS_PASSWORD`}}", + "openstack_tenant_name": "{{env `OS_TENANT_NAME`}}", + "openstack_domain_name": "{{env `OS_USER_DOMAIN_NAME`}}", + "openstack_region": "{{env `OS_REGION_NAME`}}", + "source_image_id": "{{env `OS_SOURCE_IMAGE_ID`}}", + "flavor_name": "cpu.2c_2g", + "network_name": "{{env `OS_NETWORK_NAME`}}", + "image_name": "ubuntu 22.04-{{timestamp}} server", + "floating_ip_pool": "{{env `OS_FLOATING_IP_POOL`}}", + "ssh_username": "ubuntu" + }, + "builders": [ + { + "type": "openstack", + "identity_endpoint": "{{user `openstack_auth_url`}}", + "username": "{{user `openstack_username`}}", + "password": "{{user `openstack_password`}}", + "tenant_name": "{{user `openstack_tenant_name`}}", + "domain_name": "{{user `openstack_domain_name`}}", + "region": "{{user `openstack_region`}}", + "image_name": "{{user `image_name`}}", + "source_image": "{{user `source_image_id`}}", + "flavor": "{{user `flavor_name`}}", + "networks": [ + "{{user `network_name`}}" + ], + "ssh_username": "{{user `ssh_username`}}", + "security_groups": [ + "default" + ], + "floating_ip_pool": "private_provider", + "use_floating_ip": true, + "ssh_timeout": "10m", + "image_disk_format": "raw", + "use_blockstorage_volume": true + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "sudo apt-get update", + "sudo apt-get upgrade -y", + "sudo apt-get autoremove -y", + "echo 'Initial system updates and cleanup complete.'" + ] + }, + { + "type": "file", + "source": "pbr-script-cloud-init.yaml", + "destination": "/tmp/pbr-script-cloud-init.yaml" + }, + { + "type": "shell", + "inline": [ + "sudo mv /tmp/pbr-script-cloud-init.yaml /etc/cloud/cloud.cfg.d/99-custom-pbr-script.cfg", + "echo 'Cloud-init configuration moved to /etc/cloud/cloud.cfg.d/'" + ] + } + ] +} \ No newline at end of file