Author's posts

django-mptt로 tree 구조 만들기.

django-mptt, tree 구조를 쉽게(?) 구현하기. 1. 설치 pip install django-mptt 2. 설정하기(project/settings.py) 프로젝트의 settings.py에 아래 내용 추가 INSTALLED_APPS = [ #3’rd party APP ‘mptt’, #django-mptt, 이부분을 추가해야 한다. # below is django default apps… ‘django.contrib.admin’, ‘django.contrib.auth’, ‘django.contrib.contenttypes’, ‘django.contrib.sessions’, ‘django.contrib.messages’, ‘django.contrib.staticfiles’, ] 들여쓰기를 조정하고 싶은경우 아래 부분도 추가해줌(settings.py 맨 마지막에) MPTT_ADMIN_LEVEL_INDENT = 5

Continue reading

CentOS7, TFTP server 설치 사용하기.

CentOS7, TFTP server 설치 사용하기. 작업환경: CentOS 7, firewalld 사용안함, selinux 사용안함. tftp서버는 xinetd에 의해 제어되기때문에, xinetd도 함께 설치해야한다. # yum install tftp-server xinetd xinetd의 tftp 설정확인.(기본 tftp root 디렉토리를 변경하려면, 아래 14번 줄의 /var/lib/tftpboot를 변경하면된다.) # cat /etc/xinetd.d/tftp # default: off # description: The tftp server serves files using the trivial file transfer \ …

Continue reading

Ubuntu 리눅스에 TACACS+ 인증서버 설치하고 시스코 스위치에 적용하기

우분투 리눅스에 TACACS+ 인증서버 설치하기 설치환경: TACACS+ 설치 : ubuntu 18.04, ip address: 192.168.0.6 Cisco switch: C3550, ip address: 192.168.0.200 1. 작업 환경 확인 및 tacacs plus 설치 리눅스 버전 확인 $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic TACACS+ 설치 $ sudo apt-get …

Continue reading

extreme switch OS 업그레이드 – scp 이용 –

SCP를 이용한 익스트림 스위치 OS 업그레이드 이전 tftp 서버를 이용한 exos 업그레이드에 이어, scp를 이용하여 익스트림 스위치 OS를 업그레이드 한다. ssh 서버: 192.168.0.6 스위치 : 192.168.0.10 exos image file 위치: 192.168.0.6:/home/snowfox/exos/summitX-16.2.5.4-patch1-7.xos 1. ssh를 사용가능하도록 한다. X440-24p.2 # enable ssh2 WARNING: Generating new server host key This could take approximately 15 minutes and cannot be canceled. …

Continue reading

익스트림 스위치 os 업그레이드 – tftp 서버 이용 –

TFTP 서버를 이용한 EXOS 업그레이드 * 작업환경 모델: summit x440-24p, IP 주소:192.168.0.10 TFTP server : 192.168.0.2 작업에 사용한 스위치는 한번도 사용하지 않은 장비로, 아무런 설정이 되어 있지 않은 상태. 1. 장비 os 확인 * X440-24p.1 # sh switch SysName: X440-24p SysLocation: SysContact: support@extremenetworks.com, +1 888 257 3000 System MAC: 00:04:96:9D:13:A0 System Type: X440-24p SysHealth check: …

Continue reading

파이썬, UnicodeDecodeError

파이썬에서 os 명령어를 실행하는 프로그램을 작성하고 실행할때, 때때로 아래와 같은 오류가 발생했다. python3.6 code: import subprocess def linux_cmd(cmd, s): s = s.strip() p = subprocess.Popen([cmd, s], stdout=subprocess.PIPE) r = p.communicate() return r[0] if __name__==’__main__’: k = linux_cmd(‘cat’, ‘a.txt’) print(k)

Continue reading

MySQL, INET_ATON으로 IP 주소 정렬하기

MySQL INET_ATON으로 IP 주소 정렬하기. mysql에서 ip 주소(char type field)를 정렬하면 원하는 결과가 나오지 않는다. mysql> select ip from device_device where category_id=2 order by ip; +—————-+ | ip | +—————-+ | 192.168.100.1 | | 192.168.100.10 | | 192.168.100.11 | … | 192.168.100.35 | | 192.168.100.36 | | 192.168.100.37 | | 192.168.100.4 | | 192.168.100.5 | …

Continue reading

mysql 문자셋으로 인한 django 프로그램에서 db error

Django 에서 아래와 같은 오류 발생 django.db.utils.OperationalError: (1366, “Incorrect string value: ‘\\xE2\\x80\\x8B9F-…’ for column ‘address’ at row 1”) 원인은 mysql 데이타베이스와 테이블의 문자셋이 utf-8이 아니어서 발생했다. database의 문자셋을 확인해보면, latin1 이다. mysql> status; ————– mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper Connection id: 462073 Current database: information Current user: information@localhost SSL: …

Continue reading

MAC 주소로 NIC 제조사 찾기.

https://tools.boxcorea.com/macvendor 이곳을 이용해 주시기 바랍니다. https://mac.boxcorea.com : 초기 버전으로 유지보수가 쉽지 않아 업데이트를 중지합니다. 대신 새로운 사이트를 이용해 주시기 바랍니다. python-django로, MAC 주소로 랜카드 제조사 찾는 프로그램을 만들었습니다. 이용해보시고, 오류있으면 알려주시기 바랍니다.

Django2, template에 dict 타입 데이타 표시하기

테스트를 위해 view를 만든다.app/views.py 에 테스트 뷰를 만든다. class TestView(TemplateView): template_name = test.html’ context = [ {‘IP ADDRESS’: ‘192.168.100.1’, ‘HOSTNAME’: ‘Fox’, ‘Connect’: ‘ssh’}, {‘IP ADDRESS’: ‘192.168.100.2’, ‘HOSTNAME’: ‘Wolf’, ‘Connect’: ‘telnet’}, {‘IP ADDRESS’: ‘192.168.100.3’, ‘HOSTNAME’: ‘Hotdog’, ‘Connect’: ‘ssh’}, ] def get(self, request): return render(request, self.template_name, {‘context’: self.context})

Continue reading