侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

树莓派玩机笔记(四)获取公网地址

2023-05-17 星期三 / 0 评论 / 0 点赞 / 76 阅读 / 4803 字

感谢CCTV,感谢MTV,感谢高主任帮我写的脚本。原文刊载于高主任cu论坛-http://blog.chinaunix.net/uid-25256412-id-4228235.html1>:安装配置p

.

感谢CCTV,感谢MTV,感谢高主任帮我写的脚本。

原文刊载于高主任cu论坛-http://blog.chinaunix.net/uid-25256412-id-4228235.html

 

1>: 安装配置postfix

# apt-get install postfix   (安装postfix)或:# aptitude install postfix# echo 'www.yes4ko.com' >/etc/hostname   (修改主机名)# echo 'X.X.X.X www.yes4ko.com www' >> /etc/hosts# echo 'X.X.X.X ftp.yes4ko.com ftp' >> /etc/hosts# vim /etc/postfix/main.cfmyhostname = www.yes4ko.com            (主机名FQDN)alias_maps = hash:/etc/aliasesalias_database = hash:/etc/aliasesmyorigin = yes4ko.com                    (发件人地址)mydestination = www.yes4ko.com, localhost.localdomain    (允许收件的主机)relayhost =                       (由于是非公网domain,需要由上游ISP MTA帮忙送信,置空即可!)mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 hash:/etc/postfix/access    (只允许这些地址使用postfix)mailbox_size_limit = 0recipient_delimiter = +inet_interfaces = allinet_protocols = ipv4relay_domains = yes4ko.com, localhost:wq# vim /etc/postfix/access.yes4ko.com  OK            (允许此domain使用postfix)X.X.X.       REJECT        (拒绝X.X.X.0/24使用postfix):wq# postalias hash:/etc/aliases        (重新生成)# postmap hash:/etc/postfix/access# /etc/init.d/postfix reload  (重新加载配置文件)# /etc/init.d/postfix check   (检查 postfix 相关的配置文件)# /etc/init.d/postfix start   (运行 postfix 服务)# /etc/init.d/postfix stop    (停止 postfix 服务)# /usr/sbin/postqueue -p        (查看邮件队列排队的邮件)或:# mailq# /etc/init.d/postfix flush   (强制将目前正在邮件队列排队的邮件寄出)

 

2>: 自动获取公网地址

 

# vim /usr/sbin/getPubIP.sh        (编写脚本取得公网IP并mail至相关邮箱)#!/bin/sh#Program: save as /usr/sbin/getPubIP.sh#DATE=$(date +'%Y-%m-%d %H:%M:%S')curl ifconfig.me/ip > getip.txt 2>&1echo $DATE >> getip.txttail -2 getip.txt| mail -s 'Today's Public IP Addr' [email protected]:wq

 

3>: 配置 routine

 

# echo '07 */1 * * * root /usr/sbin/getPubIP.sh' >> /etc/crontab (每间隔1小时执行一次该脚本)

 

4>: Reserved for future use....

5>: Reserved for future use....

6>: Reserved for future use....

7>: Reserved for future use....


More About Debian :  http://bbs.chinaunix.net/thread-3751791-1-1.html
More About Postfix: http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client

.

广告 广告

评论区